If you are using the package for the first time, you will first have to install it.
# install.packages("survival")
If you have already downloaded this package in the current version of R, you will only have to load the package.
library(survival)
## Warning: package 'survival' was built under R version 4.0.4
Load a data set from a package.
You can use the double colon symbol (:), to return the pbc and pbcseq objects from the package survival. We store these data sets to new objects with the names pbc and pbcseq.
pbc <- survival::pbc
pbcseq <- survival::pbcseq
Remember that for indexing/subsetting we need to use the square brackets.
Select the 3rd element from vector age
of the pbc data set.
pbc$age[3]
## [1] 70.07255
Select the sex
of the 10th patient of the pbc data set.
pbc$sex[10]
## [1] f
## Levels: m f
Remove the 1st element from the id
vector of the pbc data set.
pbc$id[-1]
## [1] 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
## [19] 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
## [37] 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
## [55] 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
## [73] 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
## [91] 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
## [109] 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
## [127] 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
## [145] 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
## [163] 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181
## [181] 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
## [199] 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217
## [217] 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235
## [235] 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253
## [253] 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271
## [271] 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
## [289] 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307
## [307] 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325
## [325] 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343
## [343] 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361
## [361] 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379
## [379] 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397
## [397] 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415
## [415] 416 417 418
From the vector age
of the pbc data set, select patients that are younger than 30.
pbc$age[pbc$age < 30]
## [1] 28.88433 29.55510 26.27789
From the vector age
of the pbc data set, select only female
patients.
pbc$age[pbc$sex == "f"]
## [1] 58.76523 56.44627 54.74059 38.10541 66.25873 55.53457 53.05681 42.50787
## [9] 70.55989 53.71389 59.13758 45.68925 64.64613 40.44353 52.18344 53.93018
## [17] 49.56057 59.95346 56.27652 55.96715 45.07324 52.02464 54.43943 44.94730
## [25] 63.87680 41.38535 41.55236 53.99589 51.28268 52.06023 48.61875 56.41068
## [33] 61.72758 36.62697 55.39220 46.66940 33.63450 33.69473 48.87064 37.58248
## [41] 41.79329 45.79877 47.42779 61.15264 53.50856 52.08761 67.40862 39.19781
## [49] 33.61807 53.57153 40.39425 58.38193 60.70637 46.62834 62.90760 40.20260
## [57] 51.28816 32.61328 49.33881 56.39973 48.84600 32.49281 38.49418 51.92060
## [65] 43.51814 51.94251 49.82615 47.94524 46.51608 63.26352 67.31006 56.01369
## [73] 55.83025 47.21697 52.75838 37.27858 41.39357 52.44353 45.60712 76.70910
## [81] 36.53388 53.91650 46.39014 48.84600 28.88433 44.95003 56.56947 48.96372
## [89] 43.01711 34.03970 68.50924 62.52156 50.35729 44.06297 38.91034 41.15264
## [97] 55.45791 51.23340 42.63929 61.07050 49.65640 48.85421 54.25599 55.43600
## [105] 45.82067 47.18138 53.59890 44.10404 41.94935 63.61396 44.22724 62.00137
## [113] 40.55305 42.33539 42.96783 55.96167 62.86105 46.76249 54.07529 47.03628
## [121] 55.72621 46.10267 52.28747 51.20055 33.86448 75.01164 30.86379 34.98700
## [129] 55.04175 49.60438 43.55647 59.40862 48.75838 36.49281 57.37166 42.74333
## [137] 58.81725 53.49760 43.41410 41.35524 47.75359 35.49076 48.66256 52.66804
## [145] 49.86995 30.27515 55.56742 52.15332 41.60986 55.45243 70.00411 43.94251
## [153] 42.56810 44.56947 56.94456 40.26010 37.60712 48.36140 70.83641 35.79192
## [161] 62.62286 50.64750 54.52704 52.69268 52.72005 56.77207 44.39699 29.55510
## [169] 57.04038 44.62697 35.79740 40.71732 32.23272 41.09240 61.63997 37.05681
## [177] 62.57906 48.97741 61.99042 72.77207 61.29500 52.62423 52.91444 47.26352
## [185] 50.20397 69.34702 41.16906 59.16496 36.07940 34.59548 42.71321 63.63039
## [193] 56.62971 46.26420 61.24298 38.62012 38.77070 56.69541 36.92266 62.41478
## [201] 34.60917 58.33539 50.18207 42.68583 34.37919 33.18275 38.38193 59.76181
## [209] 66.41205 46.78987 56.07940 41.37440 64.57221 67.48802 44.82957 45.77139
## [217] 32.95003 41.22108 55.41684 47.98084 40.79124 56.97467 68.46270 39.85763
## [225] 35.31006 31.44422 58.26420 51.48802 59.96988 52.36413 42.78713 34.87474
## [233] 44.13963 46.38193 56.30938 70.90760 55.39493 45.08419 26.27789 50.47228
## [241] 38.39836 47.41958 47.98084 38.31622 50.10815 35.08830 32.50376 56.15332
## [249] 46.15469 65.88364 33.94387 62.86105 48.56400 46.34908 38.85284 58.64750
## [257] 48.93634 65.98494 40.90075 57.19644 31.38125 52.72553 38.09172 58.17112
## [265] 45.21013 37.79877 60.65982 35.53457 43.06639 56.39151 30.57358 61.18275
## [273] 58.29979 62.33265 37.99863 33.15264 60.00000 64.99932 54.00137 75.00068
## [281] 62.00137 43.00068 46.00137 44.00000 64.00000 40.00000 63.00068 34.00137
## [289] 52.00000 48.99932 54.00137 63.00068 46.00137 52.99932 56.00000 56.00000
## [297] 55.00068 64.99932 56.00000 47.00068 60.00000 52.99932 54.00137 50.00137
## [305] 48.00000 36.00000 48.00000 70.00137 51.00068 54.00137 48.00000 66.00137
## [313] 52.99932 62.00137 59.00068 39.00068 67.00068 58.00137 64.00000 46.00137
## [321] 64.00000 40.99932 48.99932 44.00000 59.00068 63.00068 60.99932 64.00000
## [329] 48.99932 42.00137 50.00137 51.00068 36.99932 62.00137 51.00068 52.00000
## [337] 32.99932 60.00000 63.00068 32.99932 51.00068 36.99932 59.00068 55.00068
## [345] 48.99932 40.00000 67.00068 40.99932 68.99932 52.00000 56.99932 36.00000
## [353] 50.00137 64.00000 62.00137 42.00137 44.00000 68.99932 52.00000 66.00137
## [361] 40.00000 52.00000 46.00137 51.00068 43.00068 39.00068 51.00068 67.00068
## [369] 35.00068 67.00068 39.00068 56.99932 58.00137 52.99932
Select the 3rd column of the pbc data set. To do so we type 3 in the second index which represents the columns.Â
pbc[, 3]
## [1] 2 0 2 2 1 2 0 2 2 2 2 2 0 2 2 0 2 2 0 2 0 2 2 2 0 2 2 2 0 2 2 0 2 0 2 0 2
## [38] 2 2 0 2 0 0 2 0 2 0 0 2 2 2 2 2 2 2 2 2 0 2 0 0 2 2 2 0 2 2 0 2 0 0 0 0 2
## [75] 2 2 2 2 0 2 2 2 0 0 2 2 2 0 2 2 2 2 0 2 2 0 2 0 0 2 0 0 2 2 1 2 0 2 0 2 1
## [112] 2 2 2 0 0 2 2 2 1 2 0 2 0 1 2 0 2 0 2 2 0 2 0 0 0 0 2 0 0 0 2 2 2 0 0 0 2
## [149] 2 0 0 2 0 2 0 2 0 1 2 0 0 2 2 2 2 0 2 0 2 0 0 0 0 0 0 2 0 0 0 0 0 0 1 2 0
## [186] 2 2 0 0 0 2 0 2 0 0 0 0 0 0 0 0 0 0 2 2 0 0 2 0 0 0 0 0 2 2 0 2 0 0 2 0 2
## [223] 2 0 0 0 2 0 2 0 2 0 0 0 0 0 0 0 2 0 1 0 2 2 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0
## [260] 0 0 0 1 1 1 0 2 2 0 0 0 0 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 1 2 0 1 0 0 0 1 0
## [297] 1 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 2 0 0 2 0 0 2 0 0 0 0 0 2 2 2 2 2 2
## [334] 2 0 0 2 2 0 0 2 0 2 0 1 2 2 0 0 2 2 0 0 2 0 2 0 0 0 2 1 1 0 2 0 2 0 2 2 2
## [371] 2 0 0 0 1 2 0 2 2 1 0 2 1 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 2 0 0 0 0 2 0
## [408] 0 0 0 0 0 0 2 0 0 0 0
Different ways exist to obtain that. As shown below, we can also use double square bracket with a single index.
pbc[[3]]
## [1] 2 0 2 2 1 2 0 2 2 2 2 2 0 2 2 0 2 2 0 2 0 2 2 2 0 2 2 2 0 2 2 0 2 0 2 0 2
## [38] 2 2 0 2 0 0 2 0 2 0 0 2 2 2 2 2 2 2 2 2 0 2 0 0 2 2 2 0 2 2 0 2 0 0 0 0 2
## [75] 2 2 2 2 0 2 2 2 0 0 2 2 2 0 2 2 2 2 0 2 2 0 2 0 0 2 0 0 2 2 1 2 0 2 0 2 1
## [112] 2 2 2 0 0 2 2 2 1 2 0 2 0 1 2 0 2 0 2 2 0 2 0 0 0 0 2 0 0 0 2 2 2 0 0 0 2
## [149] 2 0 0 2 0 2 0 2 0 1 2 0 0 2 2 2 2 0 2 0 2 0 0 0 0 0 0 2 0 0 0 0 0 0 1 2 0
## [186] 2 2 0 0 0 2 0 2 0 0 0 0 0 0 0 0 0 0 2 2 0 0 2 0 0 0 0 0 2 2 0 2 0 0 2 0 2
## [223] 2 0 0 0 2 0 2 0 2 0 0 0 0 0 0 0 2 0 1 0 2 2 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0
## [260] 0 0 0 1 1 1 0 2 2 0 0 0 0 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 1 2 0 1 0 0 0 1 0
## [297] 1 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 2 0 0 2 0 0 2 0 0 0 0 0 2 2 2 2 2 2
## [334] 2 0 0 2 2 0 0 2 0 2 0 1 2 2 0 0 2 2 0 0 2 0 2 0 0 0 2 1 1 0 2 0 2 0 2 2 2
## [371] 2 0 0 0 1 2 0 2 2 1 0 2 1 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 2 0 0 0 0 2 0
## [408] 0 0 0 0 0 0 2 0 0 0 0
Select the baseline details of the 5th patient of the pbc data set. In that case we only need to specify the row index.
pbc[pbc$id == 5, ]
## id time status trt age sex ascites hepato spiders edema bili chol
## 5 5 1504 1 2 38.10541 f 0 1 1 0 3.4 279
## albumin copper alk.phos ast trig platelet protime stage
## 5 3.53 143 671 113.15 72 136 10.9 3
Select the serum bilirubin for all males
of the pbc data set. In that case we need to specify the row and column index.
pbc[pbc$sex == "m", "bili"]
## [1] 1.4 0.8 0.6 2.1 1.9 6.0 1.8 0.7 0.6 1.4 7.2 1.6 2.0 1.8 2.3 3.2 3.5 1.3 0.6
## [20] 1.5 7.3 3.0 2.3 2.4 2.5 4.0 0.9 0.9 2.3 7.1 5.6 4.0 8.6 6.6 2.4 1.2 1.3 3.5
## [39] 0.9 9.5 1.7 1.7 3.0 1.1
Different ways exist to obtain that. We can take the vector bili
and then look for male
patients.
pbc$bili[pbc$sex == "m"]
## [1] 1.4 0.8 0.6 2.1 1.9 6.0 1.8 0.7 0.6 1.4 7.2 1.6 2.0 1.8 2.3 3.2 3.5 1.3 0.6
## [20] 1.5 7.3 3.0 2.3 2.4 2.5 4.0 0.9 0.9 2.3 7.1 5.6 4.0 8.6 6.6 2.4 1.2 1.3 3.5
## [39] 0.9 9.5 1.7 1.7 3.0 1.1
Select the age
for male
patients or patients that have serum bilirubin
more than 5 of the pbc data set. Here we want one of the two conditions to be satisfied, therefore we use the symbol |.
pbc[pbc$sex == "m" | pbc$bili > 5, "age"]
## [1] 58.76523 70.07255 70.55989 56.22177 53.93018 59.95346 64.18891 55.96715
## [9] 44.52019 52.02464 54.43943 44.94730 61.72758 33.63450 45.79877 49.13621
## [17] 50.54073 65.76318 44.56947 43.89870 46.62834 46.45311 49.33881 51.92060
## [25] 43.51814 51.94251 49.82615 47.94524 67.41136 63.26352 33.47570 46.39014
## [33] 71.89322 48.46817 51.46886 41.15264 51.23340 52.82683 49.65640 35.15127
## [41] 67.90691 45.82067 52.88980 41.94935 44.22724 62.64476 51.24983 52.28747
## [49] 30.86379 61.80424 69.94114 69.37714 59.40862 45.76044 43.41410 53.30595
## [57] 41.35524 60.95825 37.60712 35.79192 52.69268 56.77207 49.76318 41.16906
## [65] 36.07940 61.24298 58.95140 33.18275 67.48802 41.22108 78.43943 74.52430
## [73] 70.90760 55.39493 32.50376 65.88364 58.64750 48.93634 67.57290 50.24504
## [81] 57.19644 60.53662 35.35113 55.98631 58.17112 33.15264 60.99932 54.00137
## [89] 52.99932 56.00000 47.00068 52.99932 54.00137 48.00000 36.00000 52.00000
## [97] 66.00137 40.99932 48.99932 48.99932 50.00137 51.00068 44.00000 40.99932
## [105] 51.00068 54.00137 48.99932 68.00000 62.00137 42.00137 54.00137
Different ways exist to obtain that. We can take the vector age and from there look for male
patients or patients that have serum bilirubin
more than 5.
pbc$age[pbc$sex == "m" | pbc$bili > 5]
## [1] 58.76523 70.07255 70.55989 56.22177 53.93018 59.95346 64.18891 55.96715
## [9] 44.52019 52.02464 54.43943 44.94730 61.72758 33.63450 45.79877 49.13621
## [17] 50.54073 65.76318 44.56947 43.89870 46.62834 46.45311 49.33881 51.92060
## [25] 43.51814 51.94251 49.82615 47.94524 67.41136 63.26352 33.47570 46.39014
## [33] 71.89322 48.46817 51.46886 41.15264 51.23340 52.82683 49.65640 35.15127
## [41] 67.90691 45.82067 52.88980 41.94935 44.22724 62.64476 51.24983 52.28747
## [49] 30.86379 61.80424 69.94114 69.37714 59.40862 45.76044 43.41410 53.30595
## [57] 41.35524 60.95825 37.60712 35.79192 52.69268 56.77207 49.76318 41.16906
## [65] 36.07940 61.24298 58.95140 33.18275 67.48802 41.22108 78.43943 74.52430
## [73] 70.90760 55.39493 32.50376 65.88364 58.64750 48.93634 67.57290 50.24504
## [81] 57.19644 60.53662 35.35113 55.98631 58.17112 33.15264 60.99932 54.00137
## [89] 52.99932 56.00000 47.00068 52.99932 54.00137 48.00000 36.00000 52.00000
## [97] 66.00137 40.99932 48.99932 48.99932 50.00137 51.00068 44.00000 40.99932
## [105] 51.00068 54.00137 48.99932 68.00000 62.00137 42.00137 54.00137
Select the first measurement per patient using the pbcseq
data set.
Tip: use the function duplicated()
.
First think of whether you want to select rows or columns. In that case we want to select rows therefore the first index should be specified.
The code duplicated(pbcseq[, "id"])
will return a logical vector indicating whether the element is duplicated or not.
We want the opposite (not dublicated). In R we can obtain the opposite by using the symbol !.
pbcseq[!duplicated(pbcseq[, "id"]), ]
## id futime status trt age sex day ascites hepato spiders edema bili
## 1 1 400 2 1 58.76523 f 0 1 1 1 1.0 14.5
## 3 2 5169 0 1 56.44627 f 0 0 1 1 0.0 1.1
## 12 3 1012 2 1 70.07255 m 0 0 0 0 0.5 1.4
## 16 4 1925 2 1 54.74059 f 0 0 1 1 0.5 1.8
## 23 5 1505 1 0 38.10541 f 0 0 1 1 0.0 3.4
## 29 6 2503 2 0 66.25873 f 0 0 1 0 0.0 0.8
## 35 7 2501 0 0 55.53457 f 0 0 1 0 0.0 1.0
## 42 8 2466 2 0 53.05681 f 0 0 0 0 0.0 0.3
## 50 9 2400 2 1 42.50787 f 0 0 0 1 0.0 3.2
## 57 10 51 2 0 70.55989 f 0 1 0 1 1.0 12.6
## 58 11 3762 2 0 53.71389 f 0 0 1 1 0.0 1.4
## 70 12 304 2 0 59.13758 f 0 0 0 1 0.0 3.6
## 72 13 4247 0 0 45.68925 f 0 0 0 0 0.0 0.7
## 84 14 1217 2 0 56.22177 m 0 1 1 0 1.0 0.8
## 91 15 3584 2 1 64.64613 f 0 0 0 0 0.0 0.8
## 102 16 4345 0 0 40.44353 f 0 0 0 0 0.0 0.7
## 115 17 769 2 0 52.18344 f 0 0 1 0 0.0 2.7
## 118 18 132 2 1 53.93018 f 0 0 1 1 1.0 11.4
## 119 19 4901 0 1 49.56057 f 0 0 1 0 0.5 0.7
## 134 20 1356 2 0 59.95346 f 0 0 1 0 0.0 5.1
## 138 21 3657 2 0 64.18891 m 0 0 1 1 0.0 0.6
## 150 22 673 2 1 56.27652 f 0 0 0 1 0.0 3.4
## 153 23 264 2 0 55.96715 f 0 1 1 1 1.0 17.4
## 155 24 4079 2 1 44.52019 m 0 0 1 0 0.0 2.1
## 168 25 4796 0 0 45.07324 f 0 0 0 0 0.0 0.7
## 180 26 1444 2 0 52.02464 f 0 0 1 1 0.0 5.2
## 186 27 77 2 0 54.43943 f 0 1 1 1 0.5 21.6
## 187 28 549 2 0 44.94730 f 0 1 1 1 1.0 17.2
## 190 29 5074 2 0 63.87680 f 0 0 0 0 0.0 0.7
## 200 30 321 2 0 41.38535 f 0 0 1 1 0.0 3.6
## 203 31 3839 2 0 41.55236 f 0 0 1 0 0.0 4.7
## 215 32 5192 0 0 53.99589 f 0 0 1 0 0.5 1.8
## 231 33 3170 2 0 51.28268 f 0 0 0 0 0.0 0.8
## 241 34 4602 0 1 52.06023 f 0 0 0 0 0.5 0.8
## 255 35 2847 2 0 48.61875 f 0 0 0 0 0.0 1.2
## 259 36 4281 0 0 56.41068 f 0 0 0 0 0.0 0.3
## 270 37 223 2 1 61.72758 f 0 1 1 0 1.0 7.1
## 272 38 3244 2 0 36.62697 f 0 0 1 1 0.0 3.3
## 282 39 2297 2 1 55.39220 f 0 0 1 0 0.0 0.7
## 290 40 5136 0 1 46.66940 f 0 0 0 0 0.0 1.3
## 305 41 1350 2 1 33.63450 f 0 0 1 0 0.0 6.8
## 309 42 5122 0 0 33.69473 f 0 0 1 1 0.0 2.1
## 325 43 5225 0 1 48.87064 f 0 0 0 0 0.0 1.1
## 340 44 3428 2 0 37.58248 f 0 0 1 1 1.0 3.3
## 351 45 4694 0 0 41.79329 f 0 0 0 0 0.0 0.6
## 360 46 2256 2 1 45.79877 f 0 0 1 0 0.0 5.7
## 368 47 3245 0 0 47.42779 f 0 0 0 0 0.0 0.5
## 375 48 5096 0 0 49.13621 m 0 0 0 0 0.0 1.9
## 384 49 708 2 0 61.15264 f 0 0 1 0 0.0 0.8
## 388 50 2598 2 1 53.50856 f 0 0 1 0 0.0 1.1
## 397 51 3853 2 0 52.08761 f 0 0 0 0 0.0 0.8
## 407 52 2386 2 1 50.54073 m 0 0 0 0 0.0 6.0
## 416 53 1000 2 1 67.40862 f 0 0 1 0 0.0 2.6
## 419 54 1434 2 1 39.19781 f 0 1 1 1 1.0 1.3
## 424 55 1360 2 1 65.76318 m 0 0 0 0 0.0 1.8
## 430 56 1847 2 0 33.61807 f 0 0 1 1 0.0 1.1
## 436 57 3282 2 1 53.57153 f 0 0 1 0 0.5 2.3
## 447 58 5128 0 1 44.56947 m 0 0 0 0 0.0 0.7
## 463 59 2224 2 1 40.39425 f 0 0 1 1 0.0 0.8
## 470 60 5034 0 1 58.38193 f 0 0 0 0 0.0 0.9
## 483 61 4925 0 0 43.89870 m 0 0 0 0 0.0 0.6
## 497 62 3090 2 0 60.70637 f 0 1 0 0 0.0 1.3
## 507 63 859 2 0 46.62834 f 0 0 0 1 1.0 22.5
## 510 64 1487 2 0 62.90760 f 0 0 1 0 0.0 2.1
## 516 65 4842 0 1 40.20260 f 0 0 0 0 0.0 1.2
## 522 66 4191 2 1 46.45311 m 0 0 1 0 0.0 1.4
## 535 67 2769 2 0 51.28816 f 0 0 0 0 0.0 1.1
## 545 68 4708 0 1 32.61328 f 0 0 0 0 0.0 0.7
## 559 69 1170 2 1 49.33881 f 0 0 1 1 0.5 20.0
## 563 70 3683 2 1 56.39973 f 0 0 0 0 0.5 0.6
## 576 71 4865 0 0 48.84600 f 0 0 1 0 0.0 1.2
## 587 72 4853 0 0 32.49281 f 0 0 0 0 0.0 0.5
## 593 73 4859 0 0 38.49418 f 0 0 0 0 0.0 0.7
## 608 74 1827 2 1 51.92060 f 0 0 1 1 0.0 8.4
## 612 75 1191 2 1 43.51814 f 0 1 1 1 0.5 17.1
## 617 76 71 2 1 51.94251 f 0 0 1 1 1.0 12.2
## 618 77 326 2 0 49.82615 f 0 0 1 1 0.5 6.6
## 620 78 1690 2 1 47.94524 f 0 0 1 0 0.0 6.3
## 624 79 4376 0 1 46.51608 f 0 0 1 0 0.0 0.8
## 635 80 890 2 0 67.41136 m 0 0 1 0 0.0 7.2
## 639 81 2540 2 1 63.26352 f 0 0 1 1 0.0 2.0
## 649 82 3574 2 1 67.31006 f 0 0 0 0 0.0 4.5
## 659 83 4719 0 1 56.01369 f 0 0 1 0 0.5 1.3
## 674 84 4701 0 0 55.83025 f 0 0 0 0 0.0 0.4
## 677 85 3358 2 0 47.21697 f 0 0 1 0 0.0 2.1
## 688 86 1657 2 1 52.75838 f 0 0 1 1 0.0 5.0
## 689 87 198 2 1 37.27858 f 0 0 0 0 0.0 1.1
## 691 88 3076 2 0 41.39357 f 0 0 0 0 0.5 0.6
## 695 89 1741 2 1 52.44353 f 0 0 1 0 0.0 2.0
## 699 90 2689 2 1 33.47570 m 0 0 0 0 0.0 1.6
## 708 91 460 2 0 45.60712 f 0 0 1 1 0.5 5.0
## 711 92 389 2 1 76.70910 f 0 1 0 0 1.0 1.4
## 712 93 4583 0 1 36.53388 f 0 0 0 0 0.0 1.3
## 727 94 750 2 1 53.91650 f 0 0 1 1 0.0 3.2
## 730 95 137 2 0 46.39014 f 0 1 1 1 1.0 17.4
## 731 96 4520 0 1 48.84600 f 0 0 0 0 0.0 1.0
## 745 97 620 2 0 71.89322 m 0 0 1 0 0.5 2.0
## 749 98 4492 0 1 28.88433 f 0 0 0 0 0.0 1.0
## 763 99 4489 0 0 48.46817 m 0 0 0 0 0.0 1.8
## 776 100 552 2 0 51.46886 m 0 0 1 0 0.0 2.3
## 780 101 4250 0 0 44.95003 f 0 0 0 0 0.0 0.9
## 792 102 3770 0 1 56.56947 f 0 0 0 0 0.0 0.9
## 804 103 110 2 0 48.96372 f 0 1 1 1 1.0 2.5
## 805 104 3086 2 1 43.01711 f 0 0 0 0 0.0 1.1
## 815 105 3092 1 0 34.03970 f 0 0 1 0 0.0 1.1
## 825 106 3222 2 1 68.50924 f 0 1 1 0 0.0 2.1
## 830 107 4058 0 0 62.52156 f 0 0 0 0 0.0 0.6
## 841 108 2583 2 1 50.35729 f 0 0 0 0 0.0 0.4
## 849 109 3173 0 0 44.06297 f 0 0 0 0 0.0 0.5
## 859 110 2044 2 1 38.91034 f 0 0 1 1 0.0 1.9
## 866 111 2350 1 1 41.15264 f 0 0 0 0 0.0 5.5
## 874 112 3445 2 0 55.45791 f 0 0 1 1 0.0 2.0
## 885 113 951 2 1 51.23340 f 0 0 1 1 0.0 6.7
## 890 114 3395 2 0 52.82683 m 0 0 0 0 0.0 3.2
## 901 115 4091 0 0 42.63929 f 0 0 0 1 0.0 0.7
## 913 116 4015 0 1 61.07050 f 0 0 0 1 0.5 3.0
## 924 117 1083 2 1 49.65640 f 0 0 1 1 0.0 6.5
## 929 118 2288 2 1 48.85421 f 0 0 1 0 0.5 3.5
## 936 119 515 2 1 54.25599 f 0 0 0 1 0.0 0.6
## 938 120 2033 1 1 35.15127 m 0 0 0 0 0.0 3.5
## 946 121 191 2 0 67.90691 m 0 1 1 0 1.0 1.3
## 947 122 3966 0 1 55.43600 f 0 0 0 0 0.0 0.6
## 957 123 971 2 1 45.82067 f 0 0 1 1 1.0 5.1
## 959 124 3903 2 1 52.88980 m 0 0 1 0 0.0 0.6
## 960 125 2468 1 0 47.18138 f 0 0 1 0 0.0 1.3
## 969 126 824 2 1 53.59890 f 0 1 1 1 0.0 1.2
## 974 127 3924 0 0 44.10404 f 0 0 0 0 0.0 0.5
## 985 128 1037 2 1 41.94935 f 0 0 1 1 0.0 16.2
## 990 129 3908 0 1 63.61396 f 0 0 1 0 0.0 0.9
## 1002 130 1411 2 0 44.22724 f 0 0 1 1 0.0 17.4
## 1008 131 850 2 0 62.00137 f 0 0 1 1 0.0 2.8
## 1012 132 3613 0 1 40.55305 f 0 0 0 0 0.0 1.9
## 1018 133 2796 2 0 62.64476 m 0 0 0 0 0.0 1.5
## 1027 134 3818 0 0 42.33539 f 0 0 0 0 0.0 0.7
## 1039 135 3819 0 1 42.96783 f 0 0 0 0 0.0 0.4
## 1049 136 3767 0 1 55.96167 f 0 0 0 0 0.0 0.8
## 1058 137 3659 0 1 62.86105 f 0 0 0 0 0.0 1.1
## 1070 138 1297 2 1 51.24983 m 0 0 1 0 0.0 7.3
## 1076 139 2357 1 0 46.76249 f 0 0 1 0 0.0 1.1
## 1082 140 3728 0 1 54.07529 f 0 0 1 0 0.0 1.1
## 1094 141 3719 0 1 47.03628 f 0 0 0 0 0.0 0.9
## 1097 142 2419 2 0 55.72621 f 0 0 1 0 0.0 1.0
## 1106 143 786 2 0 46.10267 f 0 0 1 0 0.5 2.9
## 1109 144 945 2 0 52.28747 f 0 0 1 0 0.5 28.0
## 1113 145 3645 0 0 51.20055 f 0 0 0 1 0.0 0.7
## 1117 146 3086 2 0 33.86448 f 0 0 0 0 0.5 1.2
## 1124 147 3382 2 1 75.01164 f 0 0 0 0 0.5 1.2
## 1129 148 1427 2 0 30.86379 f 0 0 1 0 0.0 7.2
## 1135 149 762 2 1 61.80424 m 0 0 1 1 0.5 3.0
## 1138 150 3560 0 0 34.98700 f 0 0 0 1 0.0 1.0
## 1147 151 3539 0 1 55.04175 f 0 0 0 0 0.0 0.9
## 1158 152 1152 2 1 69.94114 m 0 0 1 0 0.0 2.3
## 1161 153 3532 0 1 49.60438 f 0 0 0 0 0.0 0.5
## 1171 154 140 2 1 69.37714 m 0 0 0 1 1.0 2.4
## 1172 155 3516 0 0 43.55647 f 0 0 1 1 0.5 0.6
## 1175 156 853 2 0 59.40862 f 0 0 1 0 0.0 25.5
## 1179 157 3504 0 0 48.75838 f 0 0 0 0 0.0 0.6
## 1190 158 2475 1 1 36.49281 f 0 0 0 0 0.0 3.4
## 1199 159 1536 2 0 45.76044 m 0 0 0 0 0.0 2.5
## 1203 160 3441 0 0 57.37166 f 0 0 0 0 0.5 0.6
## 1211 161 3466 0 0 42.74333 f 0 0 0 0 0.0 2.3
## 1222 162 186 2 0 58.81725 f 0 0 1 1 0.0 3.2
## 1223 163 2055 2 1 53.49760 f 0 0 0 0 0.0 0.3
## 1226 164 276 2 0 43.41410 f 0 0 1 1 0.5 8.5
## 1227 165 1076 2 1 53.30595 m 0 0 1 0 0.0 4.0
## 1232 166 3390 0 0 41.35524 f 0 0 1 0 0.0 5.7
## 1240 167 1684 2 1 60.95825 m 0 0 1 0 0.0 0.9
## 1246 168 3384 0 0 47.75359 f 0 0 1 0 0.0 0.4
## 1256 169 1212 2 0 35.49076 f 0 0 0 0 0.0 1.3
## 1261 170 3361 0 1 48.66256 f 0 0 0 0 0.0 1.2
## 1262 171 3243 0 1 52.66804 f 0 0 0 0 0.0 0.5
## 1272 172 2970 0 0 49.86995 f 0 0 0 1 0.0 1.3
## 1279 173 3326 0 1 30.27515 f 0 0 1 1 0.0 3.0
## 1288 174 3313 0 1 55.56742 f 0 0 0 0 0.0 0.5
## 1298 175 3293 0 0 52.15332 f 0 0 0 0 0.5 0.8
## 1308 176 1492 2 1 41.60986 f 0 0 1 1 0.5 3.2
## 1314 177 3278 0 0 55.45243 f 0 0 0 0 0.0 0.9
## 1315 178 3249 0 1 70.00411 f 0 0 0 0 0.0 0.6
## 1321 179 3242 0 0 43.94251 f 0 0 1 0 0.0 1.8
## 1324 180 3232 0 0 42.56810 f 0 0 0 0 0.0 4.7
## 1334 181 3225 0 1 44.56947 f 0 0 1 1 0.0 1.4
## 1335 182 3224 0 1 56.94456 f 0 0 1 0 0.0 0.6
## 1340 183 2241 1 0 40.26010 f 0 0 0 0 0.0 0.5
## 1348 184 974 2 0 37.60712 f 0 0 1 0 0.0 11.0
## 1353 185 2882 2 1 48.36140 f 0 0 0 0 0.0 0.8
## 1358 186 1576 2 1 70.83641 f 0 0 0 1 0.5 2.0
## 1362 187 733 2 0 35.79192 f 0 0 1 0 0.0 14.0
## 1366 188 2635 0 1 62.62286 f 0 0 1 0 0.0 0.7
## 1374 189 3125 0 0 50.64750 f 0 0 1 0 0.0 1.3
## 1379 190 3173 0 1 54.52704 f 0 0 0 1 0.0 2.3
## 1383 191 216 2 0 52.69268 f 0 1 1 1 0.0 24.5
## 1384 192 3112 0 1 52.72005 f 0 0 1 0 0.0 0.9
## 1394 193 797 2 0 56.77207 f 0 0 0 0 0.0 10.8
## 1398 194 3118 0 1 44.39699 f 0 0 0 0 0.0 1.5
## 1403 195 2999 0 1 29.55510 f 0 0 1 0 0.0 3.7
## 1404 196 2555 2 1 57.04038 f 0 0 1 1 0.0 1.4
## 1412 197 3034 0 1 44.62697 f 0 0 0 0 0.0 0.6
## 1421 198 3025 0 0 35.79740 f 0 0 0 1 0.0 0.7
## 1429 199 2991 0 1 40.71732 f 0 0 0 0 0.0 2.1
## 1432 200 2932 1 0 32.23272 f 0 0 0 1 0.0 4.7
## 1443 201 2963 0 0 41.09240 f 0 0 1 0 0.0 0.6
## 1453 202 2941 0 1 61.63997 f 0 0 0 0 0.0 0.5
## 1455 203 2890 0 0 37.05681 f 0 0 1 0 0.0 0.5
## 1464 204 2090 2 0 62.57906 f 0 0 0 0 0.0 0.7
## 1472 205 2081 2 1 48.97741 f 0 1 0 0 0.0 2.5
## 1477 206 2924 0 1 61.99042 f 0 0 0 0 0.0 0.6
## 1485 207 2840 0 1 72.77207 f 0 0 0 0 0.5 0.6
## 1492 208 904 2 1 61.29500 f 0 0 1 0 0.0 3.9
## 1495 209 2888 0 0 52.62423 f 0 0 1 1 0.5 0.7
## 1497 210 2893 0 0 49.76318 m 0 0 1 0 0.0 0.9
## 1507 211 2865 0 0 52.91444 f 0 0 0 0 0.5 1.3
## 1515 212 2845 0 0 47.26352 f 0 0 0 0 0.5 1.2
## 1521 213 2189 0 1 50.20397 f 0 0 0 1 0.0 0.5
## 1523 214 1786 2 0 69.34702 f 0 0 1 0 0.0 0.9
## 1527 215 1080 2 0 41.16906 f 0 0 0 0 0.0 5.9
## 1531 216 2336 0 1 59.16496 f 0 0 0 0 0.0 0.5
## 1538 217 790 2 0 36.07940 f 0 0 1 0 0.0 11.4
## 1542 218 2839 0 1 34.59548 f 0 0 0 0 0.0 0.5
## 1552 219 2826 0 0 42.71321 f 0 0 0 0 0.5 1.6
## 1558 220 1235 2 1 63.63039 f 0 0 0 1 0.0 3.8
## 1563 221 2719 0 0 56.62971 f 0 0 1 0 0.0 0.9
## 1571 222 597 2 0 46.26420 f 0 0 1 0 0.0 4.5
## 1575 223 334 2 1 61.24298 f 0 1 1 0 1.0 14.1
## 1576 224 2614 0 1 38.62012 f 0 0 0 0 0.0 1.0
## 1584 225 2691 0 1 38.77070 f 0 0 0 0 0.0 0.7
## 1593 226 2647 0 0 56.69541 f 0 0 1 0 0.0 0.5
## 1602 227 999 2 1 58.95140 m 0 0 0 0 0.0 2.3
## 1606 228 2636 0 0 36.92266 f 0 0 0 0 0.0 0.7
## 1610 229 348 2 1 62.41478 f 0 1 1 0 0.5 4.5
## 1613 230 2648 0 0 34.60917 f 0 0 1 1 0.0 3.3
## 1617 231 1165 2 0 58.33539 f 0 0 1 1 0.0 3.4
## 1621 232 2620 0 1 50.18207 f 0 0 1 0 0.0 0.4
## 1625 233 2601 0 1 42.68583 f 0 0 1 1 0.0 0.9
## 1626 234 2445 0 0 34.37919 f 0 0 0 0 0.5 0.9
## 1628 235 2302 1 0 33.18275 f 0 0 1 0 0.0 13.0
## 1630 236 2577 0 1 38.38193 f 0 0 1 1 0.0 1.5
## 1632 237 1947 1 1 59.76181 f 0 0 1 0 0.0 1.6
## 1634 238 1874 2 0 66.41205 f 0 0 0 0 0.5 0.6
## 1637 239 694 2 1 46.78987 f 0 0 1 1 0.0 0.8
## 1640 240 2500 0 1 56.07940 f 0 0 0 0 0.0 0.4
## 1648 241 837 1 0 41.37440 f 0 0 1 1 0.0 4.4
## 1652 242 2128 2 1 64.57221 f 0 0 1 0 0.0 1.9
## 1660 243 930 2 0 67.48802 f 0 0 1 0 0.0 8.0
## 1662 244 1690 2 1 44.82957 f 0 0 0 1 0.0 3.9
## 1666 245 2459 0 0 45.77139 f 0 0 1 0 0.5 0.6
## 1668 246 1435 1 1 32.95003 f 0 0 1 0 0.0 2.1
## 1674 247 940 1 1 41.22108 f 0 0 1 0 0.0 6.1
## 1678 248 2454 0 0 55.41684 f 0 0 1 0 0.0 0.8
## 1686 249 2452 0 1 47.98084 f 0 0 0 1 0.0 1.3
## 1689 250 2327 1 0 40.79124 f 0 0 1 0 0.0 0.6
## 1691 251 2307 0 1 56.97467 f 0 0 0 0 0.0 0.5
## 1692 252 2439 0 1 68.46270 f 0 0 1 1 0.0 1.1
## 1695 253 2434 0 1 78.43943 m 0 1 1 1 0.0 7.1
## 1703 254 737 1 1 39.85763 f 0 0 1 1 0.0 3.1
## 1707 255 2405 0 0 35.31006 f 0 0 1 1 0.0 0.7
## 1713 256 2370 0 1 31.44422 f 0 0 0 0 0.0 1.1
## 1719 257 2283 0 1 58.26420 f 0 0 0 0 0.0 0.5
## 1722 258 2371 0 1 51.48802 f 0 0 0 0 0.0 1.1
## 1730 259 2284 0 0 59.96988 f 0 0 1 0 0.0 3.1
## 1735 260 1674 2 0 74.52430 m 0 0 1 0 0.0 5.6
## 1736 261 2348 0 0 52.36413 f 0 0 1 1 0.0 3.2
## 1742 262 1850 1 0 42.78713 f 0 0 1 0 0.0 2.8
## 1745 263 1303 1 0 34.87474 f 0 0 1 1 0.5 1.1
## 1750 264 1542 1 0 44.13963 f 0 0 1 1 0.0 3.4
## 1754 265 1084 1 0 46.38193 f 0 0 1 0 0.0 3.5
## 1758 266 2287 0 1 56.30938 f 0 0 0 0 0.0 0.5
## 1765 267 179 2 1 70.90760 f 0 1 1 1 1.0 6.6
## 1766 268 1191 2 1 55.39493 f 0 1 1 0 0.5 6.4
## 1768 269 1898 2 0 45.08419 f 0 0 0 0 0.0 3.6
## 1775 270 2010 1 1 26.27789 f 0 0 1 1 0.0 1.0
## 1778 271 2238 0 0 50.47228 f 0 0 1 0 0.5 1.0
## 1786 272 2194 0 1 38.39836 f 0 0 0 0 0.0 0.5
## 1792 273 1649 1 0 47.41958 f 0 0 0 1 0.0 2.2
## 1795 274 1447 1 1 47.98084 f 0 0 0 0 0.0 1.6
## 1800 275 2020 0 1 38.31622 f 0 0 0 0 0.0 2.2
## 1804 276 2147 0 1 50.10815 f 0 0 0 0 0.0 1.0
## 1806 277 2105 0 0 35.08830 f 0 0 0 0 0.5 1.0
## 1811 278 1996 1 0 32.50376 f 0 0 0 0 0.0 5.6
## 1816 279 2102 0 0 56.15332 f 0 0 0 0 0.0 0.5
## 1823 280 2081 0 1 46.15469 f 0 0 0 0 0.0 1.6
## 1830 281 41 2 1 65.88364 f 0 1 0 0 1.0 17.9
## 1831 282 1673 1 0 33.94387 f 0 0 1 0 0.0 1.3
## 1835 283 2095 0 0 62.86105 f 0 0 0 0 0.0 1.1
## 1839 284 2087 0 0 48.56400 f 0 0 0 0 0.0 1.3
## 1846 285 2070 0 1 46.34908 f 0 0 0 0 0.0 0.8
## 1847 286 2077 0 1 38.85284 f 0 0 1 1 0.0 2.0
## 1849 287 1552 0 1 58.64750 f 0 0 0 1 0.0 6.4
## 1853 288 1067 1 0 48.93634 f 0 0 1 0 0.5 8.7
## 1855 289 799 2 1 67.57290 m 0 0 1 0 0.5 4.0
## 1859 290 2032 0 1 65.98494 f 0 0 0 0 0.0 1.4
## 1866 291 901 1 1 40.90075 f 0 0 0 0 0.0 3.2
## 1871 292 1785 2 0 50.24504 m 0 0 1 0 0.0 8.6
## 1874 293 1989 0 0 57.19644 f 0 0 1 1 1.0 8.5
## 1876 294 1971 0 1 60.53662 m 0 0 1 0 0.0 6.6
## 1883 295 875 1 1 35.35113 m 0 0 0 0 0.0 2.4
## 1885 296 1990 0 0 31.38125 f 0 0 0 0 0.0 0.8
## 1888 297 533 1 1 55.98631 m 0 0 1 0 0.0 1.2
## 1891 298 1969 0 0 52.72553 f 0 0 1 0 0.0 1.1
## 1894 299 1962 0 1 38.09172 f 0 0 0 0 0.0 2.4
## 1895 300 207 2 0 58.17112 f 0 0 1 0 0.0 5.2
## 1897 301 1969 0 0 45.21013 f 0 0 0 0 0.0 1.0
## 1900 302 1940 0 1 37.79877 f 0 0 0 0 0.0 0.7
## 1905 303 1597 2 0 60.65982 f 0 0 1 1 0.0 1.0
## 1909 304 1899 0 1 35.53457 f 0 0 0 0 0.0 0.5
## 1910 305 1885 0 0 43.06639 f 0 0 1 1 0.0 2.9
## 1915 306 1885 0 0 56.39151 f 0 0 1 0 0.0 0.6
## 1917 307 1818 0 0 30.57358 f 0 0 0 0 0.0 0.8
## 1922 308 1822 0 1 61.18275 f 0 0 1 0 0.0 0.4
## 1927 309 1663 0 0 58.29979 f 0 0 0 0 0.0 0.4
## 1932 310 1608 0 1 62.33265 f 0 0 0 0 0.5 1.7
## 1937 311 1508 0 1 37.99863 f 0 0 0 0 0.0 2.0
## 1941 312 1457 0 0 33.15264 f 0 0 0 1 0.0 6.4
## chol albumin alk.phos ast platelet protime stage
## 1 261 2.60 1718 138.0 190 12.2 4
## 3 302 4.14 7395 113.5 221 10.6 3
## 12 176 3.48 516 96.1 151 12.0 4
## 16 244 2.54 6122 60.6 183 10.3 4
## 23 279 3.53 671 113.2 136 10.9 3
## 29 248 3.98 944 93.0 NA 11.0 3
## 35 322 4.09 824 60.5 204 9.7 3
## 42 280 4.00 4651 28.4 373 11.0 3
## 50 562 3.08 2276 144.2 251 11.0 2
## 57 200 2.74 918 147.3 302 11.5 4
## 58 259 4.16 1104 79.1 258 12.0 4
## 70 236 3.52 591 82.2 71 13.6 4
## 72 281 3.85 1181 88.4 244 10.6 3
## 84 NA 2.27 728 71.0 156 11.0 4
## 91 231 3.87 9010 127.7 295 11.0 3
## 102 204 3.66 685 72.9 198 10.8 3
## 115 274 3.15 1533 117.8 224 10.5 4
## 118 178 2.80 961 280.6 283 12.4 4
## 119 235 3.56 1881 93.0 209 11.0 3
## 134 374 3.51 1919 122.5 322 13.0 4
## 138 252 3.83 843 65.1 336 11.4 4
## 150 271 3.63 1376 120.9 173 11.6 4
## 153 395 2.94 6065 227.0 214 11.7 4
## 155 456 4.00 5719 221.9 70 9.9 2
## 168 298 4.10 661 107.0 324 11.3 2
## 180 1128 3.68 3228 165.9 421 9.9 3
## 186 175 3.31 3697 101.9 80 12.0 4
## 187 222 3.23 1975 189.1 144 13.0 4
## 190 370 3.78 5833 73.5 390 10.6 2
## 200 260 2.54 7277 121.3 124 11.0 4
## 203 296 3.44 9933 206.4 195 10.3 2
## 215 262 3.34 7277 82.6 286 10.6 4
## 231 210 3.19 1592 218.6 180 12.0 3
## 241 364 3.70 1840 170.5 273 10.5 2
## 255 314 3.20 12259 72.2 431 10.6 3
## 259 172 3.39 558 71.3 311 10.6 2
## 270 334 3.01 6931 180.6 102 12.0 4
## 272 383 3.53 1234 138.0 234 11.0 4
## 282 282 3.00 9067 72.2 563 10.6 4
## 290 NA 3.34 11047 104.5 358 11.0 4
## 305 NA 3.26 1215 151.9 226 11.7 4
## 309 NA 3.54 8778 56.8 344 11.0 4
## 325 361 3.64 5430 67.1 203 10.6 2
## 340 299 3.55 1029 119.4 199 11.7 3
## 351 NA 3.93 1826 71.3 474 10.9 2
## 360 482 2.84 11552 136.7 518 12.7 3
## 368 316 3.65 1716 187.6 356 9.8 3
## 375 259 3.70 10397 188.3 214 11.0 3
## 384 NA 3.82 678 97.7 233 11.0 4
## 388 257 3.36 1080 107.0 128 10.6 4
## 397 276 3.60 4332 99.3 273 10.6 2
## 407 614 3.70 5084 206.4 362 10.6 1
## 416 NA 3.10 6456 56.8 214 11.0 4
## 419 288 3.40 5487 73.5 254 11.0 4
## 424 416 3.94 10165 80.0 213 11.0 3
## 430 498 3.80 13862 95.5 365 10.6 2
## 436 260 3.18 11320 105.8 216 12.4 3
## 447 242 4.08 5890 56.8 NA 10.6 1
## 463 329 3.50 7623 126.4 321 10.6 3
## 470 604 3.40 876 71.3 228 10.3 3
## 483 216 3.94 601 60.5 211 13.0 1
## 497 302 2.75 1523 43.4 329 13.2 4
## 507 932 3.12 5396 244.9 165 11.6 3
## 510 373 3.50 1009 150.4 178 11.0 3
## 516 256 3.60 724 141.1 430 10.0 1
## 522 427 3.70 1909 182.9 123 11.0 3
## 535 466 3.91 1787 328.6 261 10.0 3
## 545 174 4.09 642 71.3 203 10.6 3
## 559 652 3.46 3292 215.5 227 12.4 3
## 563 NA 4.64 666 54.3 265 10.6 2
## 576 258 3.57 2201 120.9 410 11.5 4
## 587 320 3.54 1243 122.5 225 10.0 3
## 593 132 3.60 423 49.6 265 11.0 1
## 608 558 3.99 967 89.9 278 11.0 4
## 612 674 2.53 2078 182.9 268 11.5 4
## 617 394 3.08 2132 155.0 165 11.6 4
## 618 244 3.41 1819 170.5 132 12.1 3
## 620 436 3.02 2176 170.5 236 10.6 4
## 624 315 4.24 1637 170.5 426 10.9 3
## 635 247 3.72 1303 176.7 360 11.2 4
## 639 448 3.65 1218 60.5 385 11.7 4
## 649 472 4.09 1580 117.8 412 11.1 3
## 659 250 3.50 1138 71.3 81 12.9 4
## 674 263 3.76 1345 138.0 181 11.2 3
## 677 262 3.48 2045 89.9 225 11.5 4
## 688 1600 3.21 2656 82.2 181 10.9 3
## 689 345 4.40 1860 218.6 447 10.7 3
## 691 296 4.06 1032 80.6 442 12.0 3
## 695 408 3.65 1083 110.1 200 11.4 2
## 699 660 4.22 1857 151.9 337 11.0 2
## 708 325 3.47 2460 246.5 430 11.9 4
## 711 206 3.13 1626 86.8 145 12.2 4
## 712 353 3.67 2039 232.5 380 11.1 2
## 727 201 3.11 1212 159.7 188 11.8 4
## 730 NA 2.64 559 119.4 401 11.7 2
## 731 NA 3.70 1258 99.2 338 10.4 3
## 745 420 3.26 3196 77.5 344 11.4 3
## 749 239 3.77 1877 97.7 312 10.2 1
## 763 460 3.35 1472 108.5 172 10.2 2
## 776 178 3.00 746 178.3 119 12.0 4
## 780 400 3.60 1689 164.3 327 10.4 3
## 792 248 3.97 646 62.0 128 10.1 1
## 804 188 3.67 1273 119.4 110 11.1 4
## 805 303 3.64 2108 128.7 349 11.1 2
## 815 464 4.20 1644 151.9 348 10.3 3
## 825 NA 3.90 1087 103.9 137 10.6 2
## 830 212 4.03 648 71.3 316 10.7 1
## 841 127 3.50 1062 49.6 334 10.3 2
## 849 120 3.61 804 110.1 271 10.6 3
## 859 486 3.54 1052 108.5 141 10.9 3
## 866 528 4.18 2404 172.1 467 10.7 3
## 874 267 3.67 754 196.9 136 11.8 4
## 885 374 3.74 979 128.7 266 11.1 4
## 890 259 4.30 1040 110.1 268 11.7 3
## 901 303 4.19 1584 111.6 307 10.3 3
## 913 458 3.63 1588 107.0 438 9.9 3
## 924 950 3.11 2374 170.5 354 11.0 4
## 929 390 3.30 878 138.0 207 10.2 3
## 936 636 3.83 944 97.7 306 9.5 3
## 938 325 3.98 766 130.2 344 10.6 3
## 946 151 3.08 1112 46.5 213 13.2 4
## 947 298 4.13 758 65.1 256 10.7 3
## 957 NA 3.23 790 179.8 104 13.0 4
## 959 251 3.90 681 57.4 182 10.8 4
## 960 316 3.51 1162 147.3 238 10.0 4
## 969 269 3.12 1441 165.9 166 11.1 4
## 974 268 4.08 1174 86.8 453 10.0 2
## 985 NA 2.89 1828 299.2 123 12.6 4
## 990 420 3.87 1009 57.4 NA 9.7 3
## 1002 1775 3.43 2065 165.9 418 11.5 3
## 1008 242 3.80 614 136.4 121 13.2 4
## 1012 448 3.83 1052 127.1 181 9.8 3
## 1018 331 3.95 577 128.7 165 10.1 4
## 1027 578 3.67 1353 127.1 427 10.7 2
## 1039 263 3.57 836 74.4 445 11.0 2
## 1049 263 3.35 1636 116.3 206 9.8 2
## 1058 399 3.60 3472 155.0 344 10.1 2
## 1070 426 3.93 2424 145.7 252 10.5 3
## 1076 328 3.31 1260 94.6 142 11.6 4
## 1082 290 4.09 2120 186.0 318 10.0 3
## 1094 346 3.77 794 125.6 336 10.6 2
## 1097 364 3.48 720 134.9 283 9.9 2
## 1106 332 3.60 1492 134.9 277 11.0 4
## 1109 556 3.26 3896 198.4 335 10.0 3
## 1113 309 3.84 858 41.9 253 11.4 3
## 1117 NA 3.89 1284 173.6 239 9.4 3
## 1124 288 3.37 791 57.4 213 10.7 2
## 1129 1015 3.26 3836 198.4 330 9.8 3
## 1135 257 3.79 1664 102.3 140 9.9 4
## 1138 NA 3.63 1536 134.9 233 10.0 1
## 1147 460 3.03 721 85.3 301 9.4 2
## 1158 586 3.01 2276 114.7 339 10.9 3
## 1161 217 3.85 453 54.3 270 11.1 1
## 1171 168 2.56 1056 120.9 108 14.1 3
## 1172 220 3.35 1620 153.5 311 11.2 4
## 1175 358 3.52 2468 201.5 151 11.5 2
## 1179 286 3.42 1868 77.5 487 10.0 2
## 1190 450 3.37 1408 116.3 313 11.2 2
## 1199 317 3.46 714 130.2 207 10.1 3
## 1203 217 3.62 414 76.0 224 10.5 3
## 1211 502 3.56 964 120.9 269 9.6 2
## 1222 260 3.19 815 127.1 160 12.0 4
## 1223 233 4.08 622 66.7 358 9.9 3
## 1226 NA 3.34 1428 181.4 88 13.3 4
## 1227 196 3.45 2496 133.3 212 11.3 4
## 1232 1480 3.26 1960 457.3 213 9.5 2
## 1240 376 3.86 1015 83.7 238 10.3 4
## 1246 257 3.80 842 97.7 NA 9.2 2
## 1256 408 4.22 1387 142.6 295 10.1 3
## 1261 390 3.61 1509 88.4 263 9.0 3
## 1262 NA 4.52 784 74.4 361 10.1 3
## 1272 205 3.34 1031 91.5 217 9.8 3
## 1279 236 3.42 1403 89.9 493 9.8 2
## 1288 NA 3.85 663 79.1 311 9.7 1
## 1298 283 3.80 718 108.5 340 10.1 3
## 1308 NA 3.56 1790 139.5 149 10.1 4
## 1314 258 4.01 559 43.4 277 10.4 2
## 1315 NA 4.08 665 74.4 325 10.2 4
## 1321 396 3.83 2148 102.3 278 9.9 4
## 1324 478 4.38 1629 237.2 175 10.4 3
## 1334 248 3.58 554 76.0 79 10.3 4
## 1335 NA 3.69 674 26.4 539 9.9 2
## 1340 201 3.73 1345 54.3 445 10.1 2
## 1348 674 3.55 2412 167.4 471 9.8 3
## 1353 256 3.54 1132 74.4 192 10.5 3
## 1358 225 3.53 933 69.8 200 12.7 3
## 1362 808 3.43 2870 153.5 268 11.5 3
## 1366 187 3.48 654 120.9 164 11.0 4
## 1374 360 3.63 1812 97.7 256 9.9 3
## 1379 NA 3.93 1828 133.3 327 10.2 2
## 1383 1092 3.35 3740 147.3 399 15.2 4
## 1384 308 3.69 696 51.2 344 9.8 4
## 1394 932 3.19 2184 161.2 382 10.4 4
## 1398 293 4.30 975 125.6 336 9.1 2
## 1403 347 3.90 2544 221.7 129 11.5 4
## 1404 226 3.36 810 72.9 117 11.6 4
## 1412 266 3.97 1164 102.3 201 10.1 2
## 1421 286 2.90 1692 141.1 381 9.6 2
## 1429 392 3.43 1395 184.5 328 10.2 3
## 1432 236 3.55 1391 138.0 332 9.9 3
## 1443 235 3.20 1758 107.0 228 10.8 4
## 1453 223 3.80 1044 80.6 514 10.0 2
## 1455 149 4.04 598 52.7 166 9.9 2
## 1464 255 3.74 1024 77.5 281 10.2 3
## 1472 382 3.55 1516 238.7 126 10.3 3
## 1477 213 4.07 5300 57.4 240 11.0 1
## 1485 NA 3.33 733 85.3 259 10.1 4
## 1492 396 3.20 1440 153.5 156 10.0 4
## 1495 252 4.01 1210 72.9 309 9.5 2
## 1497 346 3.37 1098 122.5 298 10.0 2
## 1507 NA 3.76 1282 100.8 114 10.3 3
## 1515 232 3.98 1074 100.8 223 9.9 3
## 1521 400 3.40 1134 96.1 356 10.2 3
## 1523 404 3.43 1866 79.1 236 9.9 3
## 1527 1276 3.85 1204 203.1 216 10.7 3
## 1531 NA 3.68 856 55.8 146 10.4 3
## 1538 608 3.31 1790 151.9 298 10.8 4
## 1542 NA 3.89 897 66.7 423 10.1 1
## 1552 215 4.17 936 134.9 176 9.6 3
## 1558 426 3.22 2716 210.8 228 10.6 2
## 1563 360 3.65 3186 94.6 269 9.7 4
## 1571 372 3.38 2310 167.4 240 12.4 3
## 1575 448 2.43 1833 134.0 210 11.0 4
## 1576 309 3.66 1214 158.1 309 9.7 3
## 1584 274 3.66 1065 88.4 251 10.1 2
## 1593 223 3.70 884 76.0 231 9.6 3
## 1602 316 3.35 1601 179.8 394 9.7 2
## 1606 215 3.35 645 93.0 165 9.6 3
## 1610 191 3.05 1020 175.2 139 11.4 4
## 1613 302 3.41 310 83.7 95 11.5 4
## 1617 518 1.96 2250 203.1 190 10.7 4
## 1621 267 3.02 1001 133.3 265 10.6 3
## 1625 514 3.06 2622 105.4 284 9.8 4
## 1626 578 3.35 976 116.3 322 11.2 2
## 1628 1336 4.16 3510 209.3 338 11.9 3
## 1630 253 3.79 1006 139.5 341 9.7 3
## 1632 442 2.95 820 85.3 181 10.1 3
## 1634 280 3.35 1093 128.7 295 9.8 2
## 1637 300 2.94 1794 130.2 319 11.2 4
## 1640 232 3.72 369 51.2 326 10.1 3
## 1648 316 3.62 1119 114.7 282 9.8 4
## 1652 354 2.97 1553 196.9 277 9.9 3
## 1660 468 2.81 2009 198.4 233 10.0 4
## 1662 350 3.22 1268 272.8 270 9.6 3
## 1666 273 3.65 794 52.7 305 9.6 3
## 1668 387 3.77 1613 150.4 185 10.1 4
## 1674 1712 2.83 3681 158.1 297 10.0 3
## 1678 324 3.51 1237 66.7 371 10.0 3
## 1686 242 3.20 1556 175.2 195 10.6 4
## 1689 299 3.36 2769 220.1 303 10.9 4
## 1691 227 3.61 676 83.0 249 9.9 2
## 1692 246 3.35 924 113.2 317 10.0 4
## 1695 243 3.03 983 158.1 97 11.2 4
## 1703 227 3.75 1136 110.0 264 10.0 3
## 1707 193 3.85 466 53.0 156 10.3 3
## 1713 336 3.74 823 84.0 242 9.7 3
## 1719 280 4.23 377 56.0 227 10.6 2
## 1722 414 3.44 1003 99.0 271 9.6 1
## 1730 277 2.97 1110 125.0 221 9.8 3
## 1735 232 3.59 1120 98.0 248 10.9 4
## 1736 375 3.14 857 89.0 375 9.5 3
## 1742 322 3.06 2562 91.0 231 9.5 3
## 1745 432 3.57 1406 190.0 248 11.4 4
## 1750 356 3.12 1911 92.0 318 11.2 3
## 1754 348 3.20 938 120.0 296 10.0 4
## 1758 318 3.32 613 70.0 279 10.2 3
## 1765 222 2.33 620 106.0 195 12.1 4
## 1766 344 2.75 834 82.0 149 11.0 4
## 1768 374 3.50 1428 188.0 151 10.1 2
## 1775 448 3.74 1128 71.0 228 10.2 3
## 1778 321 3.50 955 111.0 289 9.7 3
## 1786 226 2.93 674 58.0 153 9.8 1
## 1792 328 3.46 1677 87.0 202 9.6 3
## 1795 NA 3.07 1995 128.0 372 9.6 4
## 1800 572 3.77 2520 92.0 309 9.5 4
## 1804 219 3.85 640 145.0 95 10.7 2
## 1806 317 3.56 1636 84.0 394 9.8 3
## 1811 338 3.70 2139 185.0 215 9.9 4
## 1816 198 3.77 911 57.0 280 9.8 2
## 1823 325 3.69 2583 142.0 284 9.6 3
## 1830 175 2.10 705 338.0 62 12.9 4
## 1831 304 3.52 1622 71.0 255 9.5 4
## 1835 412 3.99 1293 91.0 422 9.6 4
## 1839 291 3.44 1082 85.0 251 9.5 3
## 1846 253 3.48 688 57.0 252 10.0 1
## 1847 310 3.36 1257 122.0 143 9.8 3
## 1849 373 3.46 1768 120.0 258 10.1 4
## 1853 310 3.89 637 117.0 298 9.6 2
## 1855 416 3.99 960 86.0 269 9.8 2
## 1859 294 3.57 722 93.0 283 9.8 3
## 1866 339 3.18 3336 205.0 304 9.9 4
## 1871 546 3.73 1070 127.0 291 11.2 3
## 1874 194 2.98 815 163.0 122 12.3 4
## 1876 1000 3.07 3150 193.0 299 10.9 4
## 1883 646 3.83 855 127.0 306 10.3 3
## 1885 328 3.31 1105 137.0 293 10.9 4
## 1888 275 3.43 1142 75.0 217 11.3 4
## 1891 340 3.37 289 97.0 243 10.2 3
## 1894 342 3.76 1653 150.0 213 10.8 3
## 1895 NA 2.23 601 135.0 206 12.3 4
## 1897 393 3.57 1307 74.0 295 10.5 4
## 1900 335 3.95 657 52.0 268 10.6 2
## 1905 372 3.25 1190 140.0 248 10.6 4
## 1909 219 3.93 663 45.0 246 10.8 3
## 1910 426 3.61 5184 288.0 275 10.6 3
## 1915 239 3.45 1072 55.0 227 10.7 2
## 1917 273 3.56 1282 130.0 344 10.5 2
## 1922 246 3.58 797 91.0 288 10.4 2
## 1927 260 2.75 1166 70.0 231 10.8 2
## 1932 434 3.35 1713 171.0 234 10.2 2
## 1937 247 3.16 1050 117.0 335 10.5 2
## 1941 576 3.79 2115 136.0 200 10.8 2
Select the last measurement per patient using the pbcseq
data set.
We can use the exact same code as before, but we need to start checking for dublicates from the last measurement per patient.
The duplicated()
function has an argument called fromLast
for that. The code duplicated(pbcseq[, "id"], fromLast = TRUE)
will return a logical vector indicating whether the element is duplicated or not starting from the last observation per patient.
We want the opposite (not dublicated). In R we can obtain the opposite by using the symbol !.
pbcseq[!duplicated(pbcseq[, "id"], fromLast = TRUE), ]
## id futime status trt age sex day ascites hepato spiders edema bili
## 2 1 400 2 1 58.76523 f 192 1 1 1 1.0 21.3
## 11 2 5169 0 1 56.44627 f 3226 1 1 1 1.0 4.6
## 15 3 1012 2 1 70.07255 m 743 0 0 1 0.5 1.8
## 22 4 1925 2 1 54.74059 f 1824 1 1 1 1.0 5.3
## 28 5 1505 1 0 38.10541 f 1455 0 1 1 0.5 19.0
## 34 6 2503 2 0 66.25873 f 2453 NA NA NA 0.0 0.7
## 41 7 2501 0 0 55.53457 f 2262 0 0 0 0.0 1.4
## 49 8 2466 2 0 53.05681 f 2218 1 1 0 0.5 5.4
## 56 9 2400 2 1 42.50787 f 2278 1 1 0 1.0 14.8
## 57 10 51 2 0 70.55989 f 0 1 0 1 1.0 12.6
## 69 11 3762 2 0 53.71389 f 3694 1 1 1 1.0 9.6
## 71 12 304 2 0 59.13758 f 180 1 0 1 0.5 10.0
## 83 13 4247 0 0 45.68925 f 4243 0 0 0 0.0 1.2
## 90 14 1217 2 0 56.22177 m 1204 NA NA NA 0.5 0.9
## 101 15 3584 2 1 64.64613 f 3537 NA NA NA 1.0 11.4
## 114 16 4345 0 0 40.44353 f 4054 0 0 0 0.0 0.9
## 117 17 769 2 0 52.18344 f 673 1 1 1 1.0 13.6
## 118 18 132 2 1 53.93018 f 0 0 1 1 1.0 11.4
## 133 19 4901 0 1 49.56057 f 4696 0 1 0 0.0 0.8
## 137 20 1356 2 0 59.95346 f 1344 NA NA NA 0.0 32.0
## 149 21 3657 2 0 64.18891 m 3513 NA NA NA 1.0 7.8
## 152 22 673 2 1 56.27652 f 360 0 0 1 0.5 2.4
## 154 23 264 2 0 55.96715 f 182 1 1 1 1.0 19.5
## 167 24 4079 2 1 44.52019 m 4034 1 1 0 0.5 16.8
## 179 25 4796 0 0 45.07324 f 3637 0 0 1 0.0 0.7
## 185 26 1444 2 0 52.02464 f 1434 NA NA NA 1.0 16.2
## 186 27 77 2 0 54.43943 f 0 1 1 1 0.5 21.6
## 189 28 549 2 0 44.94730 f 375 1 1 1 1.0 21.3
## 199 29 5074 2 0 63.87680 f 4333 1 1 1 1.0 1.4
## 202 30 321 2 0 41.38535 f 299 1 1 1 0.5 36.0
## 214 31 3839 2 0 41.55236 f 3590 0 0 1 0.0 12.0
## 230 32 5192 0 0 53.99589 f 5152 0 0 0 0.5 0.9
## 240 33 3170 2 0 51.28268 f 3004 0 0 0 0.0 1.3
## 254 34 4602 0 1 52.06023 f 4457 0 1 0 0.5 1.0
## 258 35 2847 2 0 48.61875 f 743 0 1 0 0.0 4.2
## 269 36 4281 0 0 56.41068 f 3956 0 1 1 0.0 0.7
## 271 37 223 2 1 61.72758 f 144 1 1 1 1.0 13.5
## 281 38 3244 2 0 36.62697 f 3209 NA NA NA 0.5 5.6
## 289 39 2297 2 1 55.39220 f 2247 0 1 0 0.5 10.5
## 304 40 5136 0 1 46.66940 f 4845 0 1 1 1.0 18.0
## 308 41 1350 2 1 33.63450 f 1151 0 1 1 1.0 16.2
## 324 42 5122 0 0 33.69473 f 5118 0 1 1 0.5 13.0
## 339 43 5225 0 1 48.87064 f 4877 1 1 0 0.0 1.1
## 350 44 3428 2 0 37.58248 f 3414 NA NA NA 0.5 29.4
## 359 45 4694 0 0 41.79329 f 3219 0 0 1 0.0 0.8
## 367 46 2256 2 1 45.79877 f 2174 0 1 1 1.0 16.5
## 374 47 3245 0 0 47.42779 f 2311 0 1 0 0.0 0.9
## 383 48 5096 0 0 49.13621 m 2517 0 0 0 0.0 1.4
## 387 49 708 2 0 61.15264 f 525 NA NA NA 0.0 3.1
## 396 50 2598 2 1 53.50856 f 2561 1 0 1 1.0 5.8
## 406 51 3853 2 0 52.08761 f 3529 0 1 1 1.0 16.9
## 415 52 2386 2 1 50.54073 m 2380 1 1 1 1.0 27.1
## 418 53 1000 2 1 67.40862 f 905 NA NA NA 0.0 12.6
## 423 54 1434 2 1 39.19781 f 1125 0 1 1 1.0 18.6
## 429 55 1360 2 1 65.76318 m 1316 NA NA NA 0.0 17.0
## 435 56 1847 2 0 33.61807 f 1838 NA NA NA 0.5 41.0
## 446 57 3282 2 1 53.57153 f 3280 NA NA NA 1.0 15.6
## 462 58 5128 0 1 44.56947 m 5076 0 0 0 0.0 1.6
## 469 59 2224 2 1 40.39425 f 2096 NA NA NA 0.5 22.7
## 482 60 5034 0 1 58.38193 f 4435 0 0 0 0.0 0.7
## 496 61 4925 0 0 43.89870 m 4580 0 0 0 0.0 1.0
## 506 62 3090 2 0 60.70637 f 3073 NA NA NA 1.0 6.8
## 509 63 859 2 0 46.62834 f 385 0 1 0 0.5 17.0
## 515 64 1487 2 0 62.90760 f 1411 1 1 1 1.0 16.5
## 521 65 4842 0 1 40.20260 f 1470 0 0 0 0.0 1.4
## 534 66 4191 2 1 46.45311 m 4181 NA NA NA 0.0 9.2
## 544 67 2769 2 0 51.28816 f 2767 NA NA NA 0.5 4.7
## 558 68 4708 0 1 32.61328 f 4417 0 1 0 1.0 5.6
## 562 69 1170 2 1 49.33881 f 1050 1 1 1 1.0 21.9
## 575 70 3683 2 1 56.39973 f 3682 NA NA NA 1.0 16.6
## 586 71 4865 0 0 48.84600 f 4832 0 1 0 0.5 2.8
## 592 72 4853 0 0 32.49281 f 1475 0 0 0 0.0 0.7
## 607 73 4859 0 0 38.49418 f 4715 0 0 0 0.0 0.5
## 611 74 1827 2 1 51.92060 f 1819 NA NA NA 0.0 18.0
## 616 75 1191 2 1 43.51814 f 1078 0 1 1 0.0 6.6
## 617 76 71 2 1 51.94251 f 0 0 1 1 1.0 12.2
## 619 77 326 2 0 49.82615 f 188 1 1 0 1.0 13.2
## 623 78 1690 2 1 47.94524 f 920 NA NA NA 0.0 11.0
## 634 79 4376 0 1 46.51608 f 4091 0 1 1 0.5 2.1
## 638 80 890 2 0 67.41136 m 736 0 1 0 0.0 11.5
## 648 81 2540 2 1 63.26352 f 2529 NA NA NA 1.0 10.2
## 658 82 3574 2 1 67.31006 f 2921 0 0 0 0.5 0.7
## 673 83 4719 0 1 56.01369 f 4714 0 0 0 1.0 1.4
## 676 84 4701 0 0 55.83025 f 371 0 0 0 0.0 0.4
## 687 85 3358 2 0 47.21697 f 3228 1 1 0 1.0 14.7
## 688 86 1657 2 1 52.75838 f 0 0 1 1 0.0 5.0
## 690 87 198 2 1 37.27858 f 182 0 1 0 0.0 1.2
## 694 88 3076 2 0 41.39357 f 804 0 0 1 0.5 0.9
## 698 89 1741 2 1 52.44353 f 1671 NA NA NA 1.0 6.5
## 707 90 2689 2 1 33.47570 m 2587 1 1 1 0.0 13.4
## 710 91 460 2 0 45.60712 f 362 0 1 1 0.0 4.2
## 711 92 389 2 1 76.70910 f 0 1 0 0 1.0 1.4
## 726 93 4583 0 1 36.53388 f 4565 0 0 0 0.0 22.2
## 729 94 750 2 1 53.91650 f 383 0 1 1 0.0 9.8
## 730 95 137 2 0 46.39014 f 0 1 1 1 1.0 17.4
## 744 96 4520 0 1 48.84600 f 4263 0 0 0 0.0 0.7
## 748 97 620 2 0 71.89322 m 550 NA NA NA 0.0 7.8
## 762 98 4492 0 1 28.88433 f 4438 0 0 0 0.0 0.6
## 775 99 4489 0 0 48.46817 m 4206 0 1 0 0.0 1.6
## 779 100 552 2 0 51.46886 m 514 NA NA NA 0.5 4.4
## 791 101 4250 0 0 44.95003 f 4049 0 0 0 0.5 0.6
## 803 102 3770 0 1 56.56947 f 3354 0 1 0 0.0 0.7
## 804 103 110 2 0 48.96372 f 0 1 1 1 1.0 2.5
## 814 104 3086 2 1 43.01711 f 2913 0 1 1 1.0 11.0
## 824 105 3092 1 0 34.03970 f 2870 1 0 0 0.5 15.9
## 829 106 3222 2 1 68.50924 f 3218 NA NA NA 0.0 2.0
## 840 107 4058 0 0 62.52156 f 3494 0 0 0 0.0 0.7
## 848 108 2583 2 1 50.35729 f 2224 0 0 1 0.0 0.5
## 858 109 3173 0 0 44.06297 f 2895 0 1 0 1.0 0.5
## 865 110 2044 2 1 38.91034 f 1985 1 1 0 1.0 2.5
## 873 111 2350 1 1 41.15264 f 2190 NA NA NA 1.0 20.6
## 884 112 3445 2 0 55.45791 f 3394 NA NA NA 0.5 10.5
## 889 113 951 2 1 51.23340 f 899 NA NA NA 0.5 26.0
## 900 114 3395 2 0 52.82683 m 3390 NA NA NA 1.0 27.6
## 912 115 4091 0 0 42.63929 f 3716 0 0 0 0.0 1.1
## 923 116 4015 0 1 61.07050 f 3683 0 0 0 0.0 1.0
## 928 117 1083 2 1 49.65640 f 1070 NA NA NA 1.0 14.5
## 935 118 2288 2 1 48.85421 f 2176 1 1 1 1.0 12.0
## 937 119 515 2 1 54.25599 f 113 0 0 1 0.0 2.3
## 945 120 2033 1 1 35.15127 m 2007 NA NA NA 0.5 14.0
## 946 121 191 2 0 67.90691 m 0 1 1 0 1.0 1.3
## 956 122 3966 0 1 55.43600 f 3178 0 0 0 0.0 0.6
## 958 123 971 2 1 45.82067 f 155 1 1 1 1.0 4.7
## 959 124 3903 2 1 52.88980 m 0 0 1 0 0.0 0.6
## 968 125 2468 1 0 47.18138 f 2367 NA NA NA 1.0 13.4
## 973 126 824 2 1 53.59890 f 816 NA NA NA 1.0 10.8
## 984 127 3924 0 0 44.10404 f 3626 0 0 0 0.0 2.3
## 989 128 1037 2 1 41.94935 f 979 1 0 1 1.0 16.0
## 1001 129 3908 0 1 63.61396 f 3700 0 1 0 0.5 1.0
## 1007 130 1411 2 0 44.22724 f 1408 NA NA NA 0.5 27.2
## 1011 131 850 2 0 62.00137 f 732 1 1 1 1.0 16.2
## 1017 132 3613 0 1 40.55305 f 1488 0 0 0 0.0 1.4
## 1026 133 2796 2 0 62.64476 m 2778 NA NA NA 0.5 27.2
## 1038 134 3818 0 0 42.33539 f 3611 0 1 0 0.0 5.3
## 1048 135 3819 0 1 42.96783 f 3157 0 0 0 0.0 0.5
## 1057 136 3767 0 1 55.96167 f 3043 0 0 0 0.0 1.2
## 1069 137 3659 0 1 62.86105 f 3464 0 1 0 0.0 0.6
## 1075 138 1297 2 1 51.24983 m 1296 NA NA NA 0.5 31.6
## 1081 139 2357 1 0 46.76249 f 1813 0 1 0 0.5 4.5
## 1093 140 3728 0 1 54.07529 f 3592 0 1 0 0.0 0.9
## 1096 141 3719 0 1 47.03628 f 375 0 0 0 0.0 0.7
## 1105 142 2419 2 0 55.72621 f 2364 NA NA NA 0.5 23.4
## 1108 143 786 2 0 46.10267 f 376 0 1 1 0.5 4.5
## 1112 144 945 2 0 52.28747 f 860 0 1 0 1.0 14.1
## 1116 145 3645 0 0 51.20055 f 735 0 1 1 0.0 0.5
## 1123 146 3086 2 0 33.86448 f 2600 0 0 0 0.5 5.2
## 1128 147 3382 2 1 75.01164 f 1160 0 0 0 0.0 0.9
## 1134 148 1427 2 0 30.86379 f 1425 1 1 0 0.0 9.0
## 1137 149 762 2 1 61.80424 m 741 NA NA NA 0.0 15.4
## 1146 150 3560 0 0 34.98700 f 2577 0 1 1 0.5 1.0
## 1157 151 3539 0 1 55.04175 f 3275 0 0 1 1.0 3.4
## 1160 152 1152 2 1 69.94114 m 832 NA NA NA 0.0 4.3
## 1170 153 3532 0 1 49.60438 f 2942 0 0 0 0.0 0.4
## 1171 154 140 2 1 69.37714 m 0 0 0 1 1.0 2.4
## 1174 155 3516 0 0 43.55647 f 363 0 0 1 0.5 0.6
## 1178 156 853 2 0 59.40862 f 680 0 1 0 0.0 24.8
## 1189 157 3504 0 0 48.75838 f 3340 0 0 0 0.5 0.9
## 1198 158 2475 1 1 36.49281 f 2474 0 1 1 0.0 11.7
## 1202 159 1536 2 0 45.76044 m 742 0 1 1 0.0 6.6
## 1210 160 3441 0 0 57.37166 f 2144 0 0 0 0.5 0.8
## 1221 161 3466 0 0 42.74333 f 3414 0 0 1 0.0 3.3
## 1222 162 186 2 0 58.81725 f 0 0 1 1 0.0 3.2
## 1225 163 2055 2 1 53.49760 f 1923 NA NA NA 0.0 0.6
## 1226 164 276 2 0 43.41410 f 0 0 1 1 0.5 8.5
## 1231 165 1076 2 1 53.30595 m 978 NA NA NA 0.5 15.1
## 1239 166 3390 0 0 41.35524 f 2303 0 0 0 0.0 3.2
## 1245 167 1684 2 1 60.95825 m 1673 NA NA NA 0.0 1.2
## 1255 168 3384 0 0 47.75359 f 3086 0 0 1 0.0 0.9
## 1260 169 1212 2 0 35.49076 f 1132 0 0 0 0.0 2.2
## 1261 170 3361 0 1 48.66256 f 0 0 0 0 0.0 1.2
## 1271 171 3243 0 1 52.66804 f 2981 0 1 0 0.0 0.7
## 1278 172 2970 0 0 49.86995 f 2020 0 1 0 0.5 1.5
## 1287 173 3326 0 1 30.27515 f 2651 0 0 1 0.0 4.2
## 1297 174 3313 0 1 55.56742 f 3021 0 1 0 0.0 1.6
## 1307 175 3293 0 0 52.15332 f 2977 0 0 0 0.5 1.1
## 1313 176 1492 2 1 41.60986 f 1433 0 1 1 0.5 4.4
## 1314 177 3278 0 0 55.45243 f 0 0 0 0 0.0 0.9
## 1320 178 3249 0 1 70.00411 f 1466 0 0 0 0.0 0.7
## 1323 179 3242 0 0 43.94251 f 374 0 1 0 0.0 1.6
## 1333 180 3232 0 0 42.56810 f 2989 0 0 0 0.0 12.5
## 1334 181 3225 0 1 44.56947 f 0 0 1 1 0.0 1.4
## 1339 182 3224 0 1 56.94456 f 1141 0 0 0 0.0 0.6
## 1347 183 2241 1 0 40.26010 f 1989 0 1 1 0.0 14.5
## 1352 184 974 2 0 37.60712 f 913 NA NA NA 0.0 15.5
## 1357 185 2882 2 1 48.36140 f 1196 0 1 1 0.5 4.2
## 1361 186 1576 2 1 70.83641 f 782 0 0 1 0.5 2.6
## 1365 187 733 2 0 35.79192 f 729 NA NA NA 0.0 40.0
## 1373 188 2635 0 1 62.62286 f 2351 0 0 0 0.0 0.4
## 1378 189 3125 0 0 50.64750 f 1098 1 1 0 0.5 0.7
## 1382 190 3173 0 1 54.52704 f 796 0 0 1 0.0 2.2
## 1383 191 216 2 0 52.69268 f 0 1 1 1 0.0 24.5
## 1393 192 3112 0 1 52.72005 f 2988 0 1 0 0.0 1.3
## 1397 193 797 2 0 56.77207 f 750 1 1 1 1.0 11.7
## 1402 194 3118 0 1 44.39699 f 1734 0 1 0 0.0 1.1
## 1403 195 2999 0 1 29.55510 f 0 0 1 0 0.0 3.7
## 1411 196 2555 2 1 57.04038 f 2503 NA NA NA 1.0 2.5
## 1420 197 3034 0 1 44.62697 f 2778 0 0 0 0.0 0.9
## 1428 198 3025 0 0 35.79740 f 2236 0 1 1 0.5 1.0
## 1431 199 2991 0 1 40.71732 f 410 0 1 0 0.0 3.0
## 1442 200 2932 1 0 32.23272 f 2924 NA NA NA 0.0 24.6
## 1452 201 2963 0 0 41.09240 f 2945 0 1 1 0.5 1.4
## 1454 202 2941 0 1 61.63997 f 377 0 0 0 0.0 0.6
## 1463 203 2890 0 0 37.05681 f 2627 0 0 0 0.0 0.7
## 1471 204 2090 2 0 62.57906 f 2082 NA NA NA 0.5 12.0
## 1476 205 2081 2 1 48.97741 f 1070 1 0 0 1.0 5.4
## 1484 206 2924 0 1 61.99042 f 2198 0 0 0 0.0 0.5
## 1491 207 2840 0 1 72.77207 f 2185 0 0 0 1.0 0.8
## 1494 208 904 2 1 61.29500 f 868 NA NA NA 1.0 12.0
## 1496 209 2888 0 0 52.62423 f 217 0 0 0 0.0 0.5
## 1506 210 2893 0 0 49.76318 m 2867 0 1 1 0.0 1.3
## 1514 211 2865 0 0 52.91444 f 2590 1 0 1 1.0 3.8
## 1520 212 2845 0 0 47.26352 f 1342 0 0 0 0.0 0.7
## 1522 213 2189 0 1 50.20397 f 249 0 0 0 0.0 0.4
## 1526 214 1786 2 0 69.34702 f 732 1 1 1 0.5 4.0
## 1530 215 1080 2 0 41.16906 f 825 NA NA NA 0.5 22.5
## 1537 216 2336 0 1 59.16496 f 1989 0 1 0 0.0 7.6
## 1541 217 790 2 0 36.07940 f 725 0 1 1 1.0 34.6
## 1551 218 2839 0 1 34.59548 f 2834 0 0 0 0.0 0.5
## 1557 219 2826 0 0 42.71321 f 1366 0 0 1 0.5 2.1
## 1562 220 1235 2 1 63.63039 f 1233 NA NA NA 0.0 8.5
## 1570 221 2719 0 0 56.62971 f 2420 1 1 1 0.5 0.8
## 1574 222 597 2 0 46.26420 f 596 NA NA NA 0.0 7.3
## 1575 223 334 2 1 61.24298 f 0 1 1 0 1.0 14.1
## 1583 224 2614 0 1 38.62012 f 2434 0 0 0 0.0 5.1
## 1592 225 2691 0 1 38.77070 f 2490 0 0 0 0.0 2.0
## 1601 226 2647 0 0 56.69541 f 2643 0 0 0 0.0 0.8
## 1605 227 999 2 1 58.95140 m 996 NA NA NA 0.5 27.6
## 1609 228 2636 0 0 36.92266 f 889 0 0 0 0.0 0.9
## 1612 229 348 2 1 62.41478 f 335 1 1 0 1.0 6.2
## 1616 230 2648 0 0 34.60917 f 760 0 1 1 0.0 2.1
## 1620 231 1165 2 0 58.33539 f 797 1 1 1 0.0 14.8
## 1624 232 2620 0 1 50.18207 f 890 0 0 0 0.0 0.9
## 1625 233 2601 0 1 42.68583 f 0 0 1 1 0.0 0.9
## 1627 234 2445 0 0 34.37919 f 179 0 0 0 0.0 0.7
## 1629 235 2302 1 0 33.18275 f 190 0 1 1 0.0 14.5
## 1631 236 2577 0 1 38.38193 f 431 NA 1 1 0.0 0.8
## 1633 237 1947 1 1 59.76181 f 386 0 1 0 0.5 1.9
## 1636 238 1874 2 0 66.41205 f 376 0 1 0 0.5 0.4
## 1639 239 694 2 1 46.78987 f 689 NA NA NA 0.5 1.7
## 1647 240 2500 0 1 56.07940 f 2202 0 0 0 0.0 0.5
## 1651 241 837 1 0 41.37440 f 746 1 1 1 1.0 14.2
## 1659 242 2128 2 1 64.57221 f 2008 NA NA NA 0.5 11.8
## 1661 243 930 2 0 67.48802 f 183 0 1 0 0.0 11.0
## 1665 244 1690 2 1 44.82957 f 1211 0 1 0 0.0 8.8
## 1667 245 2459 0 0 45.77139 f 442 0 1 0 0.5 0.4
## 1673 246 1435 1 1 32.95003 f 1434 0 1 1 0.0 3.1
## 1677 247 940 1 1 41.22108 f 731 0 1 0 0.5 1.5
## 1685 248 2454 0 0 55.41684 f 2204 0 1 0 0.0 1.0
## 1688 249 2452 0 1 47.98084 f 382 0 1 1 0.0 0.8
## 1690 250 2327 1 0 40.79124 f 446 0 1 0 0.0 0.9
## 1691 251 2307 0 1 56.97467 f 0 0 0 0 0.0 0.5
## 1694 252 2439 0 1 68.46270 f 342 0 1 1 0.0 1.2
## 1702 253 2434 0 1 78.43943 m 2269 1 1 1 0.5 8.2
## 1706 254 737 1 1 39.85763 f 656 1 1 1 0.0 17.1
## 1712 255 2405 0 0 35.31006 f 1827 0 0 1 0.0 0.4
## 1718 256 2370 0 1 31.44422 f 1359 0 1 0 0.0 1.8
## 1721 257 2283 0 1 58.26420 f 361 0 0 0 0.5 0.3
## 1729 258 2371 0 1 51.48802 f 2195 0 1 0 0.0 2.1
## 1734 259 2284 0 0 59.96988 f 1979 1 0 0 0.5 8.0
## 1735 260 1674 2 0 74.52430 m 0 0 1 0 0.0 5.6
## 1741 261 2348 0 0 52.36413 f 1883 0 0 0 0.0 2.3
## 1744 262 1850 1 0 42.78713 f 447 0 1 0 0.0 1.0
## 1749 263 1303 1 0 34.87474 f 1182 0 1 0 0.5 1.4
## 1753 264 1542 1 0 44.13963 f 720 0 0 0 0.0 10.6
## 1757 265 1084 1 0 46.38193 f 720 1 1 1 0.5 9.8
## 1764 266 2287 0 1 56.30938 f 2121 0 0 0 0.0 1.2
## 1765 267 179 2 1 70.90760 f 0 1 1 1 1.0 6.6
## 1767 268 1191 2 1 55.39493 f 164 0 1 0 0.5 6.8
## 1774 269 1898 2 0 45.08419 f 1749 0 1 1 1.0 23.8
## 1777 270 2010 1 1 26.27789 f 1910 0 1 1 0.5 1.0
## 1785 271 2238 0 0 50.47228 f 2192 0 1 0 0.5 2.9
## 1791 272 2194 0 1 38.39836 f 1545 0 0 1 0.0 0.3
## 1794 273 1649 1 0 47.41958 f 416 0 1 1 0.0 4.2
## 1799 274 1447 1 1 47.98084 f 1362 0 1 1 0.0 6.5
## 1803 275 2020 0 1 38.31622 f 1301 0 1 1 0.0 2.3
## 1805 276 2147 0 1 50.10815 f 207 0 0 0 0.0 0.9
## 1810 277 2105 0 0 35.08830 f 1065 0 1 0 0.0 2.3
## 1815 278 1996 1 0 32.50376 f 713 0 1 0 0.0 12.6
## 1822 279 2102 0 0 56.15332 f 1791 0 0 0 0.0 0.6
## 1829 280 2081 0 1 46.15469 f 1838 0 0 0 0.0 1.1
## 1830 281 41 2 1 65.88364 f 0 1 0 0 1.0 17.9
## 1834 282 1673 1 0 33.94387 f 744 0 1 1 0.0 1.3
## 1838 283 2095 0 0 62.86105 f 711 0 0 0 0.0 1.3
## 1845 284 2087 0 0 48.56400 f 1838 0 0 0 0.0 1.4
## 1846 285 2070 0 1 46.34908 f 0 0 0 0 0.0 0.8
## 1848 286 2077 0 1 38.85284 f 190 0 1 0 0.0 2.6
## 1852 287 1552 0 1 58.64750 f 772 0 1 0 0.5 4.0
## 1854 288 1067 1 0 48.93634 f 199 0 1 0 0.0 9.0
## 1858 289 799 2 1 67.57290 m 798 NA NA NA 0.5 13.3
## 1865 290 2032 0 1 65.98494 f 1824 0 1 0 0.0 2.2
## 1870 291 901 1 1 40.90075 f 881 1 0 0 0.5 12.0
## 1873 292 1785 2 0 50.24504 m 1266 0 1 1 0.0 15.5
## 1875 293 1989 0 0 57.19644 f 196 0 1 1 0.5 5.7
## 1882 294 1971 0 1 60.53662 m 1933 NA NA NA 0.5 11.4
## 1884 295 875 1 1 35.35113 m 243 0 0 0 0.0 3.0
## 1887 296 1990 0 0 31.38125 f 344 0 0 0 0.0 0.8
## 1890 297 533 1 1 55.98631 m 351 1 1 0 1.0 2.2
## 1893 298 1969 0 0 52.72553 f 362 0 1 1 0.0 2.0
## 1894 299 1962 0 1 38.09172 f 0 0 0 0 0.0 2.4
## 1896 300 207 2 0 58.17112 f 145 1 1 0 0.5 17.7
## 1899 301 1969 0 0 45.21013 f 463 0 1 0 0.0 0.9
## 1904 302 1940 0 1 37.79877 f 1797 0 0 0 0.0 1.0
## 1908 303 1597 2 0 60.65982 f 1357 1 1 1 1.0 2.1
## 1909 304 1899 0 1 35.53457 f 0 0 0 0 0.0 0.5
## 1914 305 1885 0 0 43.06639 f 1233 0 1 1 0.0 2.0
## 1916 306 1885 0 0 56.39151 f 180 0 1 0 0.0 0.5
## 1921 307 1818 0 0 30.57358 f 1142 0 0 1 0.0 4.2
## 1926 308 1822 0 1 61.18275 f 1145 0 1 0 0.0 1.1
## 1931 309 1663 0 0 58.29979 f 1288 0 0 0 0.0 0.6
## 1936 310 1608 0 1 62.33265 f 1353 0 1 0 0.5 1.8
## 1940 311 1508 0 1 37.99863 f 1098 0 0 0 0.0 0.6
## 1945 312 1457 0 0 33.15264 f 1075 0 0 1 0.5 23.4
## chol albumin alk.phos ast platelet protime stage
## 2 NA 2.94 1612 6.2 183 11.2 4
## 11 237 2.67 669 88.0 100 11.5 3
## 15 185 3.25 447 88.4 109 13.3 4
## 22 140 1.83 623 131.8 101 17.0 4
## 28 91 2.09 377 156.0 101 13.9 4
## 34 NA 4.20 NA 60.0 NA 10.5 4
## 41 260 3.59 448 54.0 114 12.0 3
## 49 341 2.47 1203 120.9 238 11.3 4
## 56 418 2.41 2268 221.7 161 13.0 3
## 57 200 2.74 918 147.3 302 11.5 4
## 69 NA 2.31 660 121.0 132 15.1 4
## 71 NA 3.00 737 114.7 98 14.1 4
## 83 221 4.26 751 72.0 176 10.2 4
## 90 NA 2.39 NA 71.0 NA 11.9 4
## 101 NA 2.40 NA 114.0 NA 13.0 4
## 114 306 3.51 1004 120.0 231 11.8 4
## 117 246 2.44 539 141.0 322 12.1 4
## 118 178 2.80 961 280.6 283 12.4 4
## 133 197 3.30 798 59.0 162 11.9 4
## 137 NA 2.40 NA 156.6 NA 19.0 4
## 149 NA 2.40 NA 73.0 NA 13.8 4
## 152 NA 2.37 1756 148.8 182 11.7 4
## 154 NA 2.45 949 167.4 252 21.0 4
## 167 126 1.56 836 229.0 252 11.6 3
## 179 NA 2.83 1560 75.0 148 10.7 4
## 185 NA 1.81 NA 241.0 NA 12.5 4
## 186 175 3.31 3697 101.9 80 12.0 4
## 189 NA 2.59 1257 162.8 143 13.0 4
## 199 242 2.47 830 73.0 163 12.4 4
## 202 NA 2.90 1904 300.7 116 13.1 4
## 214 219 2.89 995 211.0 120 12.6 4
## 230 200 3.32 866 61.0 132 11.1 4
## 240 NA 3.37 1498 85.0 147 10.7 3
## 254 329 2.99 661 97.0 193 11.6 3
## 258 271 3.70 2780 117.8 473 10.5 4
## 269 236 2.76 761 43.0 220 12.3 4
## 271 NA 2.38 1737 218.6 114 13.3 4
## 281 NA 1.90 NA 69.0 NA 11.9 4
## 289 275 2.60 1034 258.9 556 10.3 4
## 304 192 2.88 1195 144.0 222 12.7 4
## 308 NA 2.73 1240 145.7 109 13.6 4
## 324 261 2.34 2337 217.0 152 12.6 4
## 339 NA 3.10 802 53.0 70 12.2 4
## 350 NA 1.90 NA 204.0 NA 16.1 4
## 359 430 3.15 73 70.0 257 9.8 3
## 367 NA 2.75 881 266.6 110 13.4 4
## 374 311 3.26 1420 99.0 151 11.5 4
## 383 235 4.15 1258 150.4 154 9.9 2
## 387 NA 2.31 NA 170.5 NA 11.3 4
## 396 266 2.86 879 187.0 82 15.1 3
## 406 197 2.82 996 134.0 198 13.5 3
## 415 NA 2.90 866 210.8 108 13.5 4
## 418 NA 2.10 NA 99.2 NA 15.3 4
## 423 NA 3.71 1152 179.8 108 12.1 4
## 429 NA 2.90 NA 182.9 NA 12.4 4
## 435 NA 3.35 NA 220.1 NA 12.4 4
## 446 NA 1.50 NA 1205.0 NA 18.4 4
## 462 291 3.68 596 77.0 235 11.5 4
## 469 NA 2.90 NA 130.2 NA 10.2 4
## 482 297 3.50 674 84.0 282 11.4 3
## 496 284 3.78 644 90.0 190 11.6 2
## 506 NA 2.53 NA 52.0 NA 11.5 4
## 509 NA 3.40 4152 252.7 274 11.0 3
## 515 NA 3.45 1424 148.8 NA 11.9 4
## 521 NA 4.10 656 48.1 399 9.3 1
## 534 NA 2.60 NA 101.0 NA 14.2 4
## 544 NA 1.65 NA 264.0 NA 10.5 4
## 558 NA 3.18 929 184.0 88 12.4 4
## 562 NA 3.68 2252 173.6 113 15.1 3
## 575 NA 2.74 NA 142.0 NA 12.5 4
## 586 210 2.73 1004 151.0 95 12.2 3
## 592 NA 3.48 1984 223.2 118 9.6 3
## 607 NA 3.46 420 54.0 257 11.4 3
## 611 NA 1.60 NA 142.6 NA 10.2 4
## 616 NA 3.95 1159 204.6 99 10.0 4
## 617 394 3.08 2132 155.0 165 11.6 4
## 619 NA 2.55 1875 170.5 145 12.6 3
## 623 NA 2.80 NA 251.1 NA 10.1 4
## 634 220 3.11 577 95.0 50 13.0 4
## 638 220 3.02 1416 217.0 381 12.1 4
## 648 NA 2.30 NA 74.0 NA 12.7 4
## 658 210 3.23 283 28.0 180 10.9 4
## 673 209 3.56 375 35.0 84 11.9 4
## 676 NA 3.62 771 74.4 122 10.4 3
## 687 NA 2.31 880 132.0 114 12.3 4
## 688 1600 3.21 2656 82.2 181 10.9 3
## 690 NA 3.98 1556 158.1 41 9.5 3
## 694 NA 3.46 1648 141.1 407 9.6 4
## 698 NA 2.15 NA 196.9 NA 13.7 2
## 707 381 2.08 1806 277.0 217 11.1 3
## 710 NA 2.82 1516 289.9 287 11.6 3
## 711 206 3.13 1626 86.8 145 12.2 4
## 726 338 3.66 606 266.0 187 11.7 4
## 729 196 2.47 1306 196.0 160 11.6 4
## 730 NA 2.64 559 119.4 401 11.7 2
## 744 321 3.46 621 54.0 247 11.0 4
## 748 NA 2.40 NA 133.3 NA 11.5 4
## 762 238 3.91 513 58.0 236 10.6 4
## 775 289 3.81 481 55.0 132 11.3 4
## 779 NA 2.20 NA 124.0 NA 12.3 4
## 791 268 3.09 658 78.0 221 11.8 4
## 803 258 3.31 481 28.0 264 11.1 2
## 804 188 3.67 1273 119.4 110 11.1 4
## 814 337 2.48 1788 282.0 108 12.2 4
## 824 NA 3.48 2036 216.0 207 11.4 3
## 829 NA 3.70 NA 46.0 NA 36.0 4
## 840 237 3.18 545 105.0 245 11.5 3
## 848 224 3.75 429 53.0 170 10.0 1
## 858 NA 3.42 698 64.0 203 11.7 3
## 865 337 2.05 1255 66.0 171 10.8 4
## 873 NA 2.60 NA 266.0 NA 13.4 4
## 884 NA 1.40 NA 214.0 NA 13.2 4
## 889 NA 3.10 NA 128.7 NA 12.6 4
## 900 NA 2.14 NA 144.0 NA 17.3 4
## 912 339 3.79 758 100.0 193 11.2 4
## 923 225 3.86 453 46.0 273 11.6 4
## 928 NA 3.06 NA 244.9 NA 10.5 4
## 935 210 2.13 1028 158.0 138 13.6 4
## 937 NA 3.83 1740 48.1 268 9.2 3
## 945 NA 2.57 NA 173.0 NA 13.3 4
## 946 151 3.08 1112 46.5 213 13.2 4
## 956 296 2.99 729 71.0 183 11.0 3
## 958 NA 2.73 763 148.8 112 12.7 4
## 959 251 3.90 681 57.4 182 10.8 4
## 968 NA 3.20 NA 264.0 NA 12.7 4
## 973 NA 2.81 NA 230.0 NA 13.2 4
## 984 397 3.34 1391 113.0 129 11.7 4
## 989 115 2.31 2023 327.1 133 21.9 4
## 1001 323 3.32 814 53.0 250 11.1 3
## 1007 NA 1.70 NA 182.9 NA 28.0 4
## 1011 NA 2.90 701 139.5 173 13.6 4
## 1017 259 3.73 919 89.0 102 10.3 4
## 1026 NA 3.30 NA 94.0 NA 11.1 4
## 1038 474 2.84 2580 160.0 171 12.8 4
## 1048 257 3.00 561 38.0 408 11.2 2
## 1057 279 3.56 598 48.0 293 11.5 4
## 1069 343 3.01 897 67.0 312 11.4 3
## 1075 NA 2.70 NA 190.7 NA 10.6 4
## 1081 215 2.76 1940 93.0 59 14.0 4
## 1093 274 3.56 812 76.0 231 11.6 4
## 1096 NA 3.50 769 110.1 301 10.6 2
## 1105 NA 2.10 NA 153.0 NA 12.7 4
## 1108 450 2.71 2178 139.5 365 12.0 4
## 1112 NA 3.33 6312 345.7 215 10.0 4
## 1116 NA 3.50 1218 48.1 468 11.0 2
## 1123 268 2.63 926 176.0 92 12.7 4
## 1128 258 3.11 443 46.5 160 10.8 3
## 1134 NA 3.04 3339 215.0 277 11.2 4
## 1137 NA 2.80 NA 148.8 NA 12.9 4
## 1146 299 3.55 1003 170.0 248 12.0 4
## 1157 226 2.36 889 66.0 154 12.2 4
## 1160 NA 3.30 NA 127.1 NA 9.5 3
## 1170 282 3.49 327 37.0 260 11.3 1
## 1171 168 2.56 1056 120.9 108 14.1 3
## 1174 NA 3.73 1496 116.3 319 10.0 4
## 1178 NA 3.56 1625 254.2 128 11.1 3
## 1189 284 3.43 1296 144.0 497 11.3 3
## 1198 844 3.40 1840 198.0 132 12.6 3
## 1202 NA 2.84 443 72.9 204 11.0 4
## 1210 254 3.31 462 53.0 325 11.3 4
## 1221 405 2.80 2052 59.0 266 10.8 3
## 1222 260 3.19 815 127.1 160 12.0 4
## 1225 NA 3.71 NA 27.0 NA 10.1 3
## 1226 NA 3.34 1428 181.4 88 13.3 4
## 1231 NA 2.67 NA 113.0 NA 15.0 4
## 1239 236 3.17 1722 233.0 280 10.5 3
## 1245 NA 3.20 NA 116.0 NA 12.9 4
## 1255 255 3.53 739 58.0 158 12.3 4
## 1260 288 3.25 1836 179.0 235 9.6 3
## 1261 390 3.61 1509 88.4 263 9.0 3
## 1271 280 3.52 1050 49.0 305 11.5 4
## 1278 173 3.10 523 63.0 147 11.4 4
## 1287 148 3.39 545 54.0 238 11.8 4
## 1297 295 3.44 1068 90.0 195 11.9 3
## 1307 216 2.86 451 65.0 98 12.4 4
## 1313 NA 2.26 1367 111.0 192 10.9 4
## 1314 258 4.01 559 43.4 277 10.4 2
## 1320 262 3.58 372 42.0 232 11.0 4
## 1323 NA 4.45 1888 141.1 177 10.1 4
## 1333 345 3.47 1270 202.0 111 12.1 4
## 1334 248 3.58 554 76.0 79 10.3 4
## 1339 228 3.84 351 29.0 495 9.7 1
## 1347 NA 3.02 3964 336.0 345 11.3 4
## 1352 NA 2.34 NA 87.0 NA 9.0 4
## 1357 286 3.16 1818 102.0 188 11.7 4
## 1361 253 3.35 1486 81.0 168 11.8 4
## 1365 NA 2.20 NA 186.0 NA 20.8 4
## 1373 189 3.49 296 35.0 182 11.8 4
## 1378 267 3.35 943 71.0 180 9.8 4
## 1382 286 3.93 1206 176.0 226 9.8 2
## 1383 1092 3.35 3740 147.3 399 15.2 4
## 1393 300 3.46 1007 68.0 210 11.8 3
## 1397 265 2.75 1159 127.0 275 12.4 4
## 1402 167 3.92 733 105.0 281 10.2 3
## 1403 347 3.90 2544 221.7 129 11.5 4
## 1411 NA 2.82 NA 102.0 NA 15.4 4
## 1420 306 3.52 1203 101.0 173 11.1 3
## 1428 385 3.15 1080 103.0 382 11.4 4
## 1431 NA 3.47 1368 217.0 298 10.0 3
## 1442 NA 2.72 NA 161.0 NA 13.4 4
## 1452 209 3.01 933 130.0 102 12.0 4
## 1454 246 3.44 642 79.1 NA 10.7 2
## 1463 178 3.66 366 48.0 150 11.3 2
## 1471 NA 2.10 NA 194.0 NA 13.3 4
## 1476 294 2.82 1132 153.0 95 11.5 3
## 1484 244 3.74 296 35.0 224 11.7 1
## 1491 210 3.30 319 36.0 232 12.0 4
## 1494 NA 3.10 NA 174.0 NA 11.2 4
## 1496 NA 3.18 1233 114.7 303 9.5 2
## 1506 324 2.92 478 55.0 166 11.6 4
## 1514 NA 3.12 386 75.0 68 13.6 3
## 1520 NA 3.63 585 47.0 214 11.0 4
## 1522 NA 4.04 943 80.6 298 10.2 3
## 1526 380 2.79 2388 86.0 374 10.9 4
## 1530 NA 2.93 NA 206.0 NA 12.7 3
## 1537 400 2.28 1746 85.0 145 13.9 4
## 1541 128 3.04 1016 105.0 308 11.8 4
## 1551 273 3.67 1010 63.0 418 10.8 2
## 1557 214 3.15 699 142.0 118 10.0 4
## 1562 NA 2.32 NA 106.0 NA 12.0 4
## 1570 NA 3.40 2199 83.0 183 11.9 4
## 1574 NA 2.40 NA 150.0 NA 12.8 3
## 1575 448 2.43 1833 134.0 210 11.0 4
## 1583 247 3.23 1115 136.0 260 13.2 4
## 1592 275 3.03 819 119.0 125 12.1 2
## 1601 251 3.47 461 54.0 217 10.5 3
## 1605 NA 2.60 NA 296.0 NA 13.3 3
## 1609 199 3.70 430 48.0 186 10.5 3
## 1612 NA 2.37 300 100.0 88 10.9 4
## 1616 224 3.13 314 90.0 78 12.5 4
## 1620 604 2.89 3009 272.0 117 16.4 4
## 1624 199 2.99 1309 149.0 263 11.5 3
## 1625 514 3.06 2622 105.4 284 9.8 4
## 1627 NA 3.35 1461 154.0 274 10.2 2
## 1629 NA 3.94 6665 335.0 287 11.9 3
## 1631 240 3.58 834 87.0 330 9.5 4
## 1633 NA 3.58 920 80.0 141 9.9 3
## 1636 277 3.71 1140 126.0 258 9.6 1
## 1639 NA 3.60 NA 87.0 NA 11.0 4
## 1647 277 4.13 368 37.0 354 11.4 3
## 1651 185 2.16 1225 273.0 211 14.1 4
## 1659 NA 3.87 NA 171.0 NA 13.4 4
## 1661 NA 2.53 2304 224.0 245 10.0 4
## 1665 740 2.58 2220 171.0 201 11.0 4
## 1667 NA 2.98 776 61.0 294 9.6 3
## 1673 55 3.43 1217 124.0 168 11.7 4
## 1677 334 2.87 2595 86.0 153 11.1 4
## 1685 301 3.36 842 62.0 295 12.1 4
## 1688 209 3.71 917 119.0 153 10.5 4
## 1690 340 3.59 2195 131.0 281 11.7 3
## 1691 227 3.61 676 83.0 249 9.9 2
## 1694 283 3.72 1494 91.0 328 10.1 4
## 1702 198 2.48 548 154.0 60 13.2 4
## 1706 NA 3.15 1427 149.0 294 10.9 3
## 1712 170 3.67 464 36.0 206 11.5 3
## 1718 278 3.11 1492 160.0 122 11.4 4
## 1721 339 3.03 314 44.0 272 10.9 2
## 1729 414 3.11 1047 85.0 240 10.9 3
## 1734 429 3.09 1563 156.0 471 11.6 3
## 1735 232 3.59 1120 98.0 248 10.9 4
## 1741 293 3.25 716 72.0 155 11.7 3
## 1744 333 3.21 1190 97.0 227 10.4 3
## 1749 560 2.74 1294 192.0 317 10.9 4
## 1753 308 3.27 3012 145.0 193 12.0 3
## 1757 303 2.89 1184 159.0 190 11.9 4
## 1764 242 3.37 463 39.0 229 11.4 3
## 1765 222 2.33 620 106.0 195 12.1 4
## 1767 NA 2.78 633 66.0 87 11.0 4
## 1774 201 2.70 1010 246.0 117 13.5 4
## 1777 353 3.00 522 57.0 129 11.2 4
## 1785 NA 3.44 828 115.0 168 11.3 4
## 1791 192 3.29 369 72.0 166 10.8 2
## 1794 568 3.37 1556 166.0 247 10.3 4
## 1799 498 2.53 3998 186.0 481 11.7 4
## 1803 832 3.44 2991 116.0 333 11.3 4
## 1805 NA 3.08 712 63.0 130 10.7 2
## 1810 308 3.31 2532 81.0 328 10.6 4
## 1815 420 2.91 1674 193.0 125 11.5 4
## 1822 241 3.47 731 46.0 261 11.5 2
## 1829 313 3.30 1506 102.0 177 11.5 3
## 1830 175 2.10 705 338.0 62 12.9 4
## 1834 276 3.04 1244 80.0 224 10.2 4
## 1838 298 3.40 1005 97.0 397 10.2 4
## 1845 351 3.27 735 76.0 258 11.5 3
## 1846 253 3.48 688 57.0 252 10.0 1
## 1848 NA 3.35 2358 222.0 46 9.8 3
## 1852 402 3.34 1778 136.0 240 10.9 4
## 1854 NA 2.74 2718 155.0 245 9.6 2
## 1858 NA 2.40 NA 92.0 NA 10.2 2
## 1865 269 3.23 683 116.0 225 11.4 4
## 1870 502 2.68 3910 141.0 137 11.5 4
## 1873 337 3.09 1158 140.0 69 13.2 3
## 1875 NA 2.88 942 163.0 183 12.3 4
## 1882 NA 2.37 NA 246.0 NA 12.1 4
## 1884 351 3.75 1333 161.0 229 10.5 4
## 1887 338 2.99 946 67.0 226 10.8 4
## 1890 230 3.65 1577 70.0 152 11.1 4
## 1893 381 3.77 2115 137.0 237 10.8 4
## 1894 342 3.76 1653 150.0 213 10.8 3
## 1896 NA 1.74 572 125.0 167 14.8 4
## 1899 354 3.45 1100 89.0 270 11.4 4
## 1904 301 3.40 940 57.0 284 11.1 3
## 1908 NA 2.65 834 98.0 214 12.5 4
## 1909 219 3.93 663 45.0 246 10.8 3
## 1914 NA 3.08 3018 204.0 206 11.9 3
## 1916 NA 3.43 746 45.0 134 10.7 2
## 1921 258 3.29 895 126.0 377 11.3 2
## 1926 294 3.11 1242 103.0 272 10.9 3
## 1931 250 3.23 1054 90.0 188 11.7 3
## 1936 364 3.19 1350 65.0 272 11.3 3
## 1940 391 3.40 2322 191.0 337 11.4 3
## 1945 741 3.42 3012 200.0 128 13.4 3
Select all male
patients that died of the pbc data set. Here we want both conditions to be satisfied, therefore we use the symbol &.
pbc[pbc$sex == "m" & pbc$status == 2, ]
## id time status trt age sex ascites hepato spiders edema bili chol
## 3 3 1012 2 1 70.07255 m 0 0 0 0.5 1.4 176
## 14 14 1217 2 2 56.22177 m 1 1 0 1.0 0.8 NA
## 24 24 4079 2 1 44.52019 m 0 1 0 0.0 2.1 456
## 52 52 2386 2 1 50.54073 m 0 0 0 0.0 6.0 614
## 55 55 1360 2 1 65.76318 m 0 0 0 0.0 1.8 416
## 66 66 4191 2 1 46.45311 m 0 1 0 0.0 1.4 427
## 80 80 890 2 2 67.41136 m 0 1 0 0.0 7.2 247
## 90 90 2689 2 1 33.47570 m 0 0 0 0.0 1.6 660
## 97 97 611 2 2 71.89322 m 0 1 0 0.5 2.0 420
## 100 100 552 2 2 51.46886 m 0 1 0 0.0 2.3 178
## 114 114 3395 2 2 52.82683 m 0 0 0 0.0 3.2 259
## 121 121 191 2 2 67.90691 m 1 1 0 1.0 1.3 151
## 133 133 2796 2 2 62.64476 m 0 0 0 0.0 1.5 331
## 138 138 1297 2 1 51.24983 m 0 1 0 0.0 7.3 426
## 149 149 762 2 1 61.80424 m 0 1 1 0.5 3.0 257
## 152 152 1152 2 1 69.94114 m 0 1 0 0.0 2.3 586
## 154 154 140 2 1 69.37714 m 0 0 1 1.0 2.4 168
## 159 159 1536 2 2 45.76044 m 0 0 0 0.0 2.5 317
## 165 165 1077 2 1 53.30595 m 0 1 0 0.0 4.0 196
## 167 167 1682 2 1 60.95825 m 0 1 0 0.0 0.9 376
## 227 227 999 2 1 58.95140 m 0 0 0 0.0 2.3 316
## 289 289 799 2 1 67.57290 m 0 1 0 0.5 4.0 416
## 330 330 1746 2 NA 54.00137 m NA NA NA 0.0 3.5 NA
## 376 376 1478 2 NA 44.00000 m NA NA NA 0.0 9.5 NA
## albumin copper alk.phos ast trig platelet protime stage
## 3 3.48 210 516.0 96.10 55 151 12.0 4
## 14 2.27 43 728.0 71.00 NA 156 11.0 4
## 24 4.00 124 5719.0 221.88 230 70 9.9 2
## 52 3.70 158 5084.4 206.40 93 362 10.6 1
## 55 3.94 121 10165.0 79.98 219 213 11.0 3
## 66 3.70 105 1909.0 182.90 171 123 11.0 3
## 80 3.72 269 1303.0 176.70 91 360 11.2 4
## 90 4.22 94 1857.0 151.90 155 337 11.0 2
## 97 3.26 62 3196.0 77.50 91 344 11.4 3
## 100 3.00 145 746.0 178.25 122 119 12.0 4
## 114 4.30 208 1040.0 110.05 78 268 11.7 3
## 121 3.08 73 1112.0 46.50 49 213 13.2 4
## 133 3.95 13 577.0 128.65 99 165 10.1 4
## 138 3.93 262 2424.0 145.70 218 252 10.5 3
## 149 3.79 290 1664.0 102.30 112 140 9.9 4
## 152 3.01 243 2276.0 114.70 126 339 10.9 3
## 154 2.56 225 1056.0 120.90 75 108 14.1 3
## 159 3.46 217 714.0 130.20 140 207 10.1 3
## 165 3.45 80 2496.0 133.30 142 212 11.3 4
## 167 3.86 200 1015.0 83.70 154 238 10.3 4
## 227 3.35 172 1601.0 179.80 63 394 9.7 2
## 289 3.99 177 960.0 86.00 242 269 9.8 2
## 330 3.63 NA NA NA NA 325 10.3 2
## 376 3.63 NA NA NA NA 292 10.2 3
Select male
patients or patients that died of the pbc data set. Here we want one of the two conditions to be satisfied, therefore we use the symbol |. Use to function head()
if you do not want to print the full data set.
head(pbc[pbc$sex == "m" | pbc$status == 2, ])
## id time status trt age sex ascites hepato spiders edema bili chol
## 1 1 400 2 1 58.76523 f 1 1 1 1.0 14.5 261
## 3 3 1012 2 1 70.07255 m 0 0 0 0.5 1.4 176
## 4 4 1925 2 1 54.74059 f 0 1 1 0.5 1.8 244
## 6 6 2503 2 2 66.25873 f 0 1 0 0.0 0.8 248
## 8 8 2466 2 2 53.05681 f 0 0 0 0.0 0.3 280
## 9 9 2400 2 1 42.50787 f 0 0 1 0.0 3.2 562
## albumin copper alk.phos ast trig platelet protime stage
## 1 2.60 156 1718.0 137.95 172 190 12.2 4
## 3 3.48 210 516.0 96.10 55 151 12.0 4
## 4 2.54 64 6121.8 60.63 92 183 10.3 4
## 6 3.98 50 944.0 93.00 63 NA 11.0 3
## 8 4.00 52 4651.2 28.38 189 373 11.0 3
## 9 3.08 79 2276.0 144.15 88 251 11.0 2
Select the serum bilirubin
measurements only for female
patients of the pbc data set.
pbc[pbc$sex == "f", "bili"]
## [1] 14.5 1.1 1.8 3.4 0.8 1.0 0.3 3.2 12.6 1.4 3.6 0.7 0.8 0.7 2.7
## [16] 11.4 0.7 5.1 3.4 17.4 0.7 5.2 21.6 17.2 0.7 3.6 4.7 1.8 0.8 0.8
## [31] 1.2 0.3 7.1 3.3 0.7 1.3 6.8 2.1 1.1 3.3 0.6 5.7 0.5 0.8 1.1
## [46] 0.8 2.6 1.3 1.1 2.3 0.8 0.9 1.3 22.5 2.1 1.2 1.1 0.7 20.0 0.6
## [61] 1.2 0.5 0.7 8.4 17.1 12.2 6.6 6.3 0.8 14.4 4.5 1.3 0.4 2.1 5.0
## [76] 1.1 0.6 2.0 5.0 1.4 1.3 3.2 17.4 1.0 1.0 0.9 0.9 2.5 1.1 1.1
## [91] 2.1 0.6 0.4 0.5 1.9 5.5 2.0 6.7 0.7 3.0 6.5 3.5 0.6 0.6 5.1
## [106] 1.3 1.2 0.5 16.2 0.9 17.4 2.8 1.9 0.7 0.4 0.8 1.1 1.1 1.1 0.9
## [121] 1.0 2.9 28.0 0.7 1.2 1.2 7.2 1.0 0.9 0.5 0.6 25.5 0.6 3.4 0.6
## [136] 2.3 3.2 0.3 8.5 5.7 0.4 1.3 1.2 0.5 1.3 3.0 0.5 0.8 3.2 0.9
## [151] 0.6 1.8 4.7 1.4 0.6 0.5 11.0 0.8 2.0 14.0 0.7 1.3 2.3 24.5 0.9
## [166] 10.8 1.5 3.7 1.4 0.6 0.7 2.1 4.7 0.6 0.5 0.5 0.7 2.5 0.6 0.6
## [181] 3.9 0.7 1.3 1.2 0.5 0.9 5.9 0.5 11.4 0.5 1.6 3.8 0.9 4.5 14.1
## [196] 1.0 0.7 0.5 0.7 4.5 3.3 3.4 0.4 0.9 0.9 13.0 1.5 1.6 0.6 0.8
## [211] 0.4 4.4 1.9 8.0 3.9 0.6 2.1 6.1 0.8 1.3 0.6 0.5 1.1 3.1 0.7
## [226] 1.1 0.5 1.1 3.1 3.2 2.8 1.1 3.4 3.5 0.5 6.6 6.4 3.6 1.0 1.0
## [241] 0.5 2.2 1.6 2.2 1.0 1.0 5.6 0.5 1.6 17.9 1.3 1.1 1.3 0.8 2.0
## [256] 6.4 8.7 1.4 3.2 8.5 0.8 1.1 2.4 5.2 1.0 0.7 1.0 0.5 2.9 0.6
## [271] 0.8 0.4 0.4 1.7 2.0 6.4 0.7 1.4 0.7 0.7 0.8 0.7 5.0 0.4 1.1
## [286] 0.6 0.6 1.8 1.5 1.2 1.0 0.7 3.1 12.6 2.8 7.1 0.6 2.1 1.8 16.0
## [301] 0.6 5.4 9.0 0.9 11.1 8.9 0.5 0.6 3.4 1.4 2.1 15.0 0.6 1.3 1.3
## [316] 1.6 2.2 3.0 0.8 0.8 1.8 5.5 18.0 0.6 2.7 0.9 1.3 1.1 13.8 4.4
## [331] 16.0 7.3 0.6 0.7 0.7 1.7 2.2 1.8 3.3 2.9 14.0 0.8 1.3 0.7 13.6
## [346] 0.9 0.7 1.2 0.4 0.7 2.0 1.4 1.6 0.5 7.3 8.1 0.5 4.2 0.8 2.5
## [361] 4.6 1.0 4.5 1.9 0.7 1.5 0.6 1.0 0.7 1.2 0.9 1.6 0.8 0.7
Select all rows of the pbc data set where the serum bilirubin
measurements are smaller that 10.
head(pbc[pbc$bili < 10, ])
## id time status trt age sex ascites hepato spiders edema bili chol
## 2 2 4500 0 1 56.44627 f 0 1 1 0.0 1.1 302
## 3 3 1012 2 1 70.07255 m 0 0 0 0.5 1.4 176
## 4 4 1925 2 1 54.74059 f 0 1 1 0.5 1.8 244
## 5 5 1504 1 2 38.10541 f 0 1 1 0.0 3.4 279
## 6 6 2503 2 2 66.25873 f 0 1 0 0.0 0.8 248
## 7 7 1832 0 2 55.53457 f 0 1 0 0.0 1.0 322
## albumin copper alk.phos ast trig platelet protime stage
## 2 4.14 54 7394.8 113.52 88 221 10.6 3
## 3 3.48 210 516.0 96.10 55 151 12.0 4
## 4 2.54 64 6121.8 60.63 92 183 10.3 4
## 5 3.53 143 671.0 113.15 72 136 10.9 3
## 6 3.98 50 944.0 93.00 63 NA 11.0 3
## 7 4.09 52 824.0 60.45 213 204 9.7 3
Create an array
ar <- array(data = 1:19, dim = c(3, 3, 2))
ar
## , , 1
##
## [,1] [,2] [,3]
## [1,] 1 4 7
## [2,] 2 5 8
## [3,] 3 6 9
##
## , , 2
##
## [,1] [,2] [,3]
## [1,] 10 13 16
## [2,] 11 14 17
## [3,] 12 15 18
Select the 2nd row of each matrix
ar[2, , ]
## [,1] [,2]
## [1,] 2 11
## [2,] 5 14
## [3,] 8 17
Select the 2nd column of each matrix
ar[, 2, ]
## [,1] [,2]
## [1,] 4 13
## [2,] 5 14
## [3,] 6 15
Select the 2nd row and column of the first matrix
ar[2, 2, 1]
## [1] 5
Create a list with 3 elements:
pbc$id
pbc$bili
for malespbc$age
> 30myList <- list(pbc$id, pbc$bili[pbc$sex == "m"], pbc$age[pbc$age > 30])
Select the second element (the output should be a list).
myList[2]
## [[1]]
## [1] 1.4 0.8 0.6 2.1 1.9 6.0 1.8 0.7 0.6 1.4 7.2 1.6 2.0 1.8 2.3 3.2 3.5 1.3 0.6
## [20] 1.5 7.3 3.0 2.3 2.4 2.5 4.0 0.9 0.9 2.3 7.1 5.6 4.0 8.6 6.6 2.4 1.2 1.3 3.5
## [39] 0.9 9.5 1.7 1.7 3.0 1.1
Select the third element (the output should be a vector).
myList[[3]]
## [1] 58.76523 56.44627 70.07255 54.74059 38.10541 66.25873 55.53457 53.05681
## [9] 42.50787 70.55989 53.71389 59.13758 45.68925 56.22177 64.64613 40.44353
## [17] 52.18344 53.93018 49.56057 59.95346 64.18891 56.27652 55.96715 44.52019
## [25] 45.07324 52.02464 54.43943 44.94730 63.87680 41.38535 41.55236 53.99589
## [33] 51.28268 52.06023 48.61875 56.41068 61.72758 36.62697 55.39220 46.66940
## [41] 33.63450 33.69473 48.87064 37.58248 41.79329 45.79877 47.42779 49.13621
## [49] 61.15264 53.50856 52.08761 50.54073 67.40862 39.19781 65.76318 33.61807
## [57] 53.57153 44.56947 40.39425 58.38193 43.89870 60.70637 46.62834 62.90760
## [65] 40.20260 46.45311 51.28816 32.61328 49.33881 56.39973 48.84600 32.49281
## [73] 38.49418 51.92060 43.51814 51.94251 49.82615 47.94524 46.51608 67.41136
## [81] 63.26352 67.31006 56.01369 55.83025 47.21697 52.75838 37.27858 41.39357
## [89] 52.44353 33.47570 45.60712 76.70910 36.53388 53.91650 46.39014 48.84600
## [97] 71.89322 48.46817 51.46886 44.95003 56.56947 48.96372 43.01711 34.03970
## [105] 68.50924 62.52156 50.35729 44.06297 38.91034 41.15264 55.45791 51.23340
## [113] 52.82683 42.63929 61.07050 49.65640 48.85421 54.25599 35.15127 67.90691
## [121] 55.43600 45.82067 52.88980 47.18138 53.59890 44.10404 41.94935 63.61396
## [129] 44.22724 62.00137 40.55305 62.64476 42.33539 42.96783 55.96167 62.86105
## [137] 51.24983 46.76249 54.07529 47.03628 55.72621 46.10267 52.28747 51.20055
## [145] 33.86448 75.01164 30.86379 61.80424 34.98700 55.04175 69.94114 49.60438
## [153] 69.37714 43.55647 59.40862 48.75838 36.49281 45.76044 57.37166 42.74333
## [161] 58.81725 53.49760 43.41410 53.30595 41.35524 60.95825 47.75359 35.49076
## [169] 48.66256 52.66804 49.86995 30.27515 55.56742 52.15332 41.60986 55.45243
## [177] 70.00411 43.94251 42.56810 44.56947 56.94456 40.26010 37.60712 48.36140
## [185] 70.83641 35.79192 62.62286 50.64750 54.52704 52.69268 52.72005 56.77207
## [193] 44.39699 57.04038 44.62697 35.79740 40.71732 32.23272 41.09240 61.63997
## [201] 37.05681 62.57906 48.97741 61.99042 72.77207 61.29500 52.62423 49.76318
## [209] 52.91444 47.26352 50.20397 69.34702 41.16906 59.16496 36.07940 34.59548
## [217] 42.71321 63.63039 56.62971 46.26420 61.24298 38.62012 38.77070 56.69541
## [225] 58.95140 36.92266 62.41478 34.60917 58.33539 50.18207 42.68583 34.37919
## [233] 33.18275 38.38193 59.76181 66.41205 46.78987 56.07940 41.37440 64.57221
## [241] 67.48802 44.82957 45.77139 32.95003 41.22108 55.41684 47.98084 40.79124
## [249] 56.97467 68.46270 78.43943 39.85763 35.31006 31.44422 58.26420 51.48802
## [257] 59.96988 74.52430 52.36413 42.78713 34.87474 44.13963 46.38193 56.30938
## [265] 70.90760 55.39493 45.08419 50.47228 38.39836 47.41958 47.98084 38.31622
## [273] 50.10815 35.08830 32.50376 56.15332 46.15469 65.88364 33.94387 62.86105
## [281] 48.56400 46.34908 38.85284 58.64750 48.93634 67.57290 65.98494 40.90075
## [289] 50.24504 57.19644 60.53662 35.35113 31.38125 55.98631 52.72553 38.09172
## [297] 58.17112 45.21013 37.79877 60.65982 35.53457 43.06639 56.39151 30.57358
## [305] 61.18275 58.29979 62.33265 37.99863 33.15264 60.00000 64.99932 54.00137
## [313] 75.00068 62.00137 43.00068 46.00137 44.00000 60.99932 64.00000 40.00000
## [321] 63.00068 34.00137 52.00000 48.99932 54.00137 63.00068 54.00137 46.00137
## [329] 52.99932 56.00000 56.00000 55.00068 64.99932 56.00000 47.00068 60.00000
## [337] 52.99932 54.00137 50.00137 48.00000 36.00000 48.00000 70.00137 51.00068
## [345] 52.00000 54.00137 48.00000 66.00137 52.99932 62.00137 59.00068 39.00068
## [353] 67.00068 58.00137 64.00000 46.00137 64.00000 40.99932 48.99932 44.00000
## [361] 59.00068 63.00068 60.99932 64.00000 48.99932 42.00137 50.00137 51.00068
## [369] 36.99932 62.00137 51.00068 52.00000 44.00000 32.99932 60.00000 63.00068
## [377] 32.99932 40.99932 51.00068 36.99932 59.00068 55.00068 54.00137 48.99932
## [385] 40.00000 67.00068 68.00000 40.99932 68.99932 52.00000 56.99932 36.00000
## [393] 50.00137 64.00000 62.00137 42.00137 44.00000 68.99932 52.00000 66.00137
## [401] 40.00000 52.00000 46.00137 54.00137 51.00068 43.00068 39.00068 51.00068
## [409] 67.00068 35.00068 67.00068 39.00068 56.99932 58.00137 52.99932
Select the third element (the output should be a vector).
Then, from the third element, select the elements that are smaller than 20. Tips: do not try doing everything in one step.
newData <- myList[[3]]
newData[newData < 20]
## numeric(0)
Create a list with 3 elements and give them names:
pbc$id
pbc$bili
for malespbc$age
< 30myList <- list(all_id = pbc$id, bili_male = pbc$bili[pbc$sex == "m"], young = pbc$age[pbc$age < 30])
Select all_id by name indexing.
myList$all_id
## [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
## [19] 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
## [37] 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
## [55] 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
## [73] 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
## [91] 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
## [109] 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
## [127] 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
## [145] 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
## [163] 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
## [181] 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
## [199] 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
## [217] 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234
## [235] 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252
## [253] 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270
## [271] 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288
## [289] 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306
## [307] 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324
## [325] 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342
## [343] 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
## [361] 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378
## [379] 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396
## [397] 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414
## [415] 415 416 417 418